Webmonit

A customer portal

Your customers already have an account somewhere: a client area, a billing tool, a shop. This page explains how to show each of them, in that place, the monitoring of their own sites: what is wrong, what to do about it and whose job the fix is, when the domain and the certificate expire, and whether the machine serving them has an incident. It does not depend on any particular tool. Anything that can make an HTTPS request from a server can do it.

How it fits together

Two parts of your system meet Webmonit. Each one gets only the access its job needs.

  • The management tool knows which customer may see what. It holds an issuer token. That token reads nothing itself: its only job is to mint, and revoke, portal tokens.
  • The portal is the page your customer opens. When it needs a customer's view, it asks the management tool for a portal token for that customer, then calls Webmonit directly, from its own server, with that token. The management tool does not relay the reads.

A portal token is read-only, always expires, and reaches one customer's view and nothing else. Webmonit applies its scope itself, in the same place it scopes every other access. A mistake in your tool can, at worst, mint a token for the wrong customer, and that token still reads that customer's sites only. It can never read two customers' sites at once, and never anything of the server's own.

customer's browser ──► your portal (server side) ──► Webmonit  /api/v1/portal/…
                              │  portal token
                              ▼
                      your management tool ──► Webmonit  /api/v1/portal/tokens
                                                 issuer token

1. Create the issuer token

In the interface, open Access › API tokens, choose Mint a token, and set the role to portal issuer. The scope of an issuer is the limit of what it may hand out:

  • everything: one issuer for your whole clientele;
  • owner: a reseller's issuer, which can only mint tokens for that reseller's customers.

From the command line, the same thing:

webmonit token create "client area" -issuer

Or through the API, with an admin token:

curl -s -X POST https://monitor.example.com/api/v1/tokens \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -d '{"label": "client area", "role": "issuer", "scope": "global"}'

The secret is shown once. Keep it in the management tool's configuration, never in a page.

An issuer token is refused everywhere except /api/v1/portal/tokens. Revoking it ends every portal token it minted.

2. Say who a customer is

A portal token names its reach in one of two ways.

  • A customer of Webmonit, with its sub-customers. Name it by its id, or by an identity the admin attached to it. An identity is any identifier your tool already uses: the client-area username, a customer number, a panel login on a given host. Attach one on the customer's page in the interface, or with POST /api/v1/customers/{id}/identities and {"kind": "external", "value": "C-1042"}.
  • Sites and hosting accounts: a list of domains, a list of hosting account ids, or both. An account covers its sites as they are now and as they will be, so a site added to it later is included without a new token. A site brings its aliases and subdomains, except a subdomain opened as a hosting account of its own: it belongs to that account, on whatever machine it lives.

3. Mint a portal token

The management tool calls, with its issuer token:

curl -s -X POST https://monitor.example.com/api/v1/portal/tokens \
  -H "Authorization: Bearer $ISSUER_TOKEN" \
  -d '{"label": "C-1042", "identities": [{"kind": "external", "value": "C-1042"}], "ttl": "15m"}'
{
  "id": 731,
  "secret": "wm_…",
  "expires": "2026-11-13T15:45:00Z",
  "scope": {"kind": "customer", "refs": [12], "write": false}
}

The body takes one of these forms:

field what it is
customers Customer ids.
identities [{"kind": "...", "value": "...", "host": "..."}]. host is a host name, for identities that only mean something on one machine, such as a panel login.
sites Domains.
accounts Hosting account ids.

customers and identities can be combined, and so can sites and accounts, but a customer form and a site form cannot be mixed in one token. Two more fields:

  • label: shown in the activity log.
  • ttl: how long the token lives, such as 15m, 8h or 30d. When it is absent, the server's default applies. It can never go past the server's maximum.

Choose the life to suit your portal:

  • a short token per visit (minutes), which nobody needs to revoke;
  • a long key per customer (months), revoked with DELETE /api/v1/portal/tokens/{id} when the customer leaves.

An issuer revokes only the tokens it minted.

4. Read the customer's view

The portal calls, from its server:

curl -s "https://monitor.example.com/api/v1/portal/sites?lang=en" \
  -H "Authorization: Bearer $PORTAL_TOKEN"
{
  "lang": "en",
  "operator": "Example Hosting",
  "sites": [
    {
      "domain": "example.com",
      "type": "principal",
      "status": "degraded",
      "since": "2026-11-12T08:14:03Z",
      "problems": [
        {
          "tag": "cert-soon",
          "control": "certificate-expiry",
          "label": "Certificate expiring",
          "means": "The certificate that makes a visitor's connection to the site secure runs out soon.",
          "do": "…",
          "whose": "host",
          "level": "notice",
          "family": "operation",
          "help_url": "https://webmonit.eu/en/docs/use/problems#cert-soon"
        },
        {
          "tag": "dmarc-none",
          "control": "dmarc",
          "label": "DMARC: p=none",
          "means": "The domain's DMARC record (v=DMARC1; p=none) sets p=none, an undefined policy that does not protect the domain: mail that fails SPF and DKIM in its name is still delivered.",
          "do": "Publish this single TXT record at _dmarc.example.com: v=DMARC1; p=quarantine",
          "whose": "site",
          "level": "warning",
          "family": "configuration",
          "expected": "v=DMARC1; p=quarantine",
          "measured": "v=DMARC1; p=none",
          "help_url": "https://webmonit.eu/en/docs/use/problems#dmarc-none"
        }
      ],
      "passed": [
        {"tag": "answers", "label": "The site answers"},
        {"tag": "certificate-valid", "label": "Valid certificate"},
        {"tag": "registration", "label": "Domain registration up to date"},
        {"tag": "dns-resolves", "label": "The domain name resolves"},
        {"tag": "ns-recommended", "label": "Recommended authoritative DNS in use"}
      ],
      "registration": {"expires": "2027-03-02T10:00:00Z", "days_left": 108, "issuer": "Example Registrar"},
      "certificate": {"expires": "2026-11-25T23:59:59Z", "days_left": 12, "issuer": "Example CA"},
      "server": "server-1"
    },
    {
      "domain": "shop.example.com",
      "type": "subdomain",
      "parent": "example.com",
      "status": "ok",
      "problems": [],
      "server": "server-1"
    }
  ],
  "hosting": [
    {"ref": "server-1", "state": "ok", "since": "2026-11-01T02:00:00Z"}
  ]
}

GET /api/v1/portal/sites/{domain} returns the same view for one site: {"site": {…}, "hosting": […]}. A domain outside the token's reach is a 404, exactly like one that does not exist.

The fields

field what it is
lang The language of the texts: en or fr.
operator The name your customers know you by, when you set it (below). The texts name it as the one to contact; without it they say "support".
domain, type, parent The name. type is principal, alias or subdomain. parent is the site it hangs from, when that site is in the token's reach too.
status, since ok, degraded, down, maintenance, paused or unknown, and since when.
problems What is wrong. Each entry has a stable tag, its plain words (label, means, do) and whose: whose job the fix is. site is the customer or whoever maintains the site, host is you, registrar is where the domain was bought. help_url is the page that explains the problem: why it happens, how it is put right, who acts. The complete list is in Problems.
problems[].level info, notice, warning or alert, quietest first, as the admin set it for the machine serving the site. A portal may show an info quietly, or not at all.
problems[].expected, problems[].measured The values the problem is about, when they are known: what is expected (the recommended name servers, the response-time threshold, the server's IPv6 address…) and what was measured (the delegation, the SPF or DMARC record, the MX, the response time, the watched address…). The texts already cite them.
passed Every control the site passes, one entry each, with its tag and its label in the customer's words. A control passes when the site's checks looked at it and none of its problems is posed. A control that does not apply to the site (the mail policy of a subdomain, IPv6 on a hosting that does not serve it, DNSSEC on an unsigned zone) is in neither list, and a check that has not run yet vouches for nothing. The tags, in this order: answers (the site answers), points-here (the domain points to its hosting), response-time (under the threshold, which the label cites), certificate-valid, certificate-expiry (not about to expire), certificate-subdomains, registration, dns-resolves, dns-consistent, dnssec, www, ipv6, spf, dmarc (p=quarantine or p=reject, cited), ns-recommended, mail-route, sitemap, plan (the hosting account matches its plan).
problems[].control The control the problem fails, one of the tags above. A control may fail on more than one problem: the number of controls a site is checked for is the length of passed plus the number of distinct control values in problems.
problems[].family operation: the site or its mail does not work, or will stop working. configuration: an anomaly or a recommendation found in its configuration, while everything works.
registration The domain's expiry (expires, days_left) and its registrar (issuer). For a subdomain, this is its domain's.
certificate The certificate's expiry, the authority that issued it, and what is wrong with it (problem), from the site's checks' most recent reading.
server A reference into hosting: which machine serves the site. Absent when no machine of yours serves it.
response_avg_ms The mean response time over the last 24 hours, in milliseconds: every answer weighs the same, both address families together; a run that got no answer (timed out, connection refused) has no time and does not count. The same figure as the detail's response_avg_ms for its default period. Absent with no answer measured.
left When the site stopped being served here, for a domain that left.
hosting[].state The machine's state in one word: ok, incident (something is going on at your end), maintenance or unknown, with since.
hosting[].name The machine's full name as the server knows it (web01.example.net), only when you allow it (below). Otherwise the portal should say "your server".

Show what Webmonit says. Ask for the customer's language with ?lang= or the Accept-Language header (English and French; English by default) and show the sentences as they come, without translating or rewording them: they are written for the customer — where the console's words address the admin, the view carries the customer's own — and a sentence that reads badly is corrected in Webmonit, for everyone. Link each problem to its help_url. Tags and states stay stable identifiers, for sorting and filtering.

A problem whose whose is host is yours to fix. A portal usually shows it as "being handled by your host" rather than as something the customer must do.

5. Show one site in detail

GET /api/v1/portal/sites/{domain}/detail gives what a portal draws as charts when the customer opens one of their domains: how fast it answers, how often it was reachable, and what its own hosting account spends. Read-only, with the same portal token, and a domain outside its reach is a 404.

parameter what it does
period 24h (default), 7d or 30d. Anything else is a 400.
points How many buckets at most, from 10 to 500 (default 200). The bucket's length is the period divided by it. Anything else is a 400.
{
  "domain": "example.com",
  "period": "7d",
  "since": "2026-11-07T10:00:00Z",
  "until": "2026-11-14T10:00:00Z",
  "bucket_s": 3024,
  "response": [
    {"family": 4, "points": [
      {"t": "2026-11-07T10:25:12Z", "total": 212.4, "dns": 3.1, "connect": 11.2, "tls": 24.8, "wait": 151.0, "download": 19.6, "results": 10, "down": 0}
    ]},
    {"family": 6, "points": [ … ]}
  ],
  "availability": {"results": 2016, "down": 2, "degraded": 5, "maintenance": 0, "ratio": 0.99901, "ratio_net": 0.99901},
  "usage": [
    {"t": "2026-11-07T10:25:12Z", "cpu": 180, "cpu_max": 950, "memory": 241172480}
  ]
}
field what it is
bucket_s The length of one bucket, in seconds. Every t is the middle of its bucket, in UTC.
response The response time of the site's own check, one line per address family (4, 6), from what a first visit gets. Every value is in milliseconds, a mean over the bucket: total, and the phases it is made of — connect, tls, wait (the request sent until the first byte: the server's part), download. dns, the name lookup, comes before the request and is not inside total. results is how many answers the bucket holds, down how many of them were failures. A bucket without any answer is absent: draw a gap, not a line. An empty list: the site has no check.
response_avg_ms The mean response time over the period, in milliseconds, every answer weighing the same, both families together; absent with no answer.
availability Over the period: results answers, of which down failures, degraded answers with something wrong and maintenance answers during declared maintenance. ratio is the share of answers that were not failures; ratio_net the same without maintenance and pauses. A page that has always answered 401 or 403 (a site behind a password) is answering: those answers are not failures until the page has once answered openly. Absent when the site has no check.
usage The site's own hosting account on its machine: cpu in thousandths of one core (1000 = one core fully busy; the mean over every reading the agent took in the bucket, about one every few seconds, a reading the account is missing from counting 0; cpu_max its highest single reading when higher) and memory in bytes (its peak in the bucket). Every bucket the agent reported in is there: 0 when the account ran nothing, a bucket missing only when the agent sent nothing. Absent when the site has no account on a machine with the agent. Never another account of the machine, nor the machine's own figures, nor the account's name.

Ask for one period at a time, when the customer opens the domain, and keep what you drew for a while: these reads cost more than the view, and they count in the token's request budget.

What a portal token never reads

The view is built field by field, never copied from a stored row, so nothing below can reach a customer by accident:

  • other customers, their sites and their accounts — even on the same machine;
  • the machines' addresses, their own metrics, groups and notes; their names, unless you allow them;
  • the names of hosting accounts, and what any account other than the site's own spends; panel details; where a site was placed before;
  • the evidence kept with incidents (response headers, page bodies, what your name servers answered);
  • your notes, acknowledgements, maintenance comments and the activity log.

Every other route of the API answers 403 to a portal token, whatever its scope.

Settings

Under Access › API tokens › Customer portal, or in the configuration file under portal::

setting default what it does
Show the server's name (portal.show_server) no Off, hosting[].name is absent.
Token life by default (portal.default_ttl) 1h When the issuer gives no ttl.
At most (portal.max_ttl) 90d A longer ttl is refused with a 400.
Requests a minute per token (portal.rate) 60 Past it: 429 with Retry-After. Applies to portal and issuer tokens.
Expired tokens kept for (portal.purge_after) 7d Then the expired or revoked portal tokens are deleted.
Operator's name (portal.operator_name) — The name your customers know you by, given as the one to contact. Empty: "support".

Answers to expect

code when
200, 201 Read, or minted.
400 A body that cannot be read: no reach given, both forms at once, a ttl that is not a duration or is past the maximum.
401 No token, an unknown one, an expired or revoked one, or one whose issuer was revoked.
403 The token's role does not reach this route: a portal token outside /portal/sites, an issuer outside /portal/tokens, a plain token on /portal/tokens.
404 A site, customer, identity or account that does not exist or is outside the token's reach. Both get the same answer.
429 Too many requests for this token; wait for Retry-After seconds.

Good practice

  • Call Webmonit from your server. The token never goes to the browser.
  • Cache what you read for a minute or two: the view changes at the pace of the checks, not of page views.
  • Every read with a portal token is in the activity log (Settings › Activity log), with the token and its reach.
  • To preview what a customer sees, an admin token can call /api/v1/portal/sites too: it reads the view of its own scope.