Sources

Source fields and loading

The fields of a source and of a card's source, which APIs fit and which don't, and short accounts of loading, notifications and History.

Loading and status files

Legato loads a page within a second of a save, and a script can wait for Pages/.status/<id>.json to say whether it took it; legato set and the MCP set_page tool do that for you. They check the page before writing it, so a page with a mistake leaves the old one as it was. How Legato loads a page and Status files have the details.

A status's ok describes the page as a whole. A card whose source or buttons are wrong still loads as a warning card of its own, saying what's wrong; check it in the panel or with Preview Source… on the page's right-click menu.

Source and page reference

Each file is one page: title, optional icon, up to 24 cards, named sources, and an optional notify and title_from; see Writing and versions for the rest. Any other top-level key stops the file loading. The optional $schema property enables editor assistance; Legato still checks the page when it loads.

A page can mix sourced cards with ordinary cards whose values are written in.

A named source contains connection settings, without map:

Source fieldRequired?Meaning
kindnohttp (the default), calendar for this Mac's own calendars, or reminders for its reminders; see Calendar sources and Reminders sources. The rest of this table is for http.
urlyes, or hosts or feedsAPI address. A source that reads every host on a list gives hosts instead, and one that reads every feed on a list gives feeds. Use HTTPS for internet APIs; plain HTTP is intended for local services. With requests, its scheme, host and port define the origin. Its path or query can carry dates.
secretnoName in Settings → Secrets, not the credential value: 1–48 lowercase letters, digits and hyphens, such as my-api.
secret_optionalnotrue: while no secret is saved for this host, requests go without signing in. For a key or password sent with each request, not a login. Mostly for host lists, where some hosts have a password and some don't.
secret_expiresnoA name for the expiry date saved with secret, such as token_expires. The date (2027-02-09) is added to the answer under that name before derive, and the name is left out when no date is saved. Lowercase letters, digits and _; not data, a request's name or a derived name.
authnoHow to authenticate. A named secret defaults to bearer authentication.
method, bodynoGET or POST, with an optional JSON body. Used for a single request to url.
headersnoCommon headers for data requests and buttons.
formatnojson (default), text, feed, prometheus or docker-logs for a single request.
requestsnoUp to 8 named requests, combined into one answer; paths use the source origin.
derivenoValues computed from the answer before mapping.
failnoWhen an answer the service sent counts as a failure all the same: { "when": condition, "message": rule }. See When the answer reports an error.
collectnoRows of the answer to keep on this Mac for other pages. See History.
everynoWhole number plus s, m, h or d, such as 15m or 2h. Minimum 1m; default 5m.

A source can also be { "dataset": "name" }: a page's history, kept on this Mac, read for the period showing. See History.

Each sourced card has exactly these connection fields:

Card source fieldRequired?Meaning
refyesA name in the page's sources object.
mapyes, unless when is setCard fields to fill, and their paths or rules. A card whose content is written out and only shows on a condition needs none.
emptyno{ "when": condition, "text": template }. When the condition holds in the answer, the card shows the text under its own label, with its buttons hidden (Add Event buttons stay), instead of a card the answer can't fill: no meetings, no open pull requests, nothing due.
whennoA condition: the card shows only while it holds. See Cards that show on a condition.
loadingnoOn a page whose param selects, what the card shows while a pick is on its way and the card reads something it changes: placeholder (the default) draws its last shape in grey, keep draws it as it was. keep suits a list whose length follows the pane beside it.
failednoOn a status card only: { "state", "detail", "after" }. Once the source has failed after times in a row (2 to 10, default 3), the card shows state (warning, critical (the default) or unknown) and detail instead of its last answer. See When a service stops answering.

Behind a path. For a service behind a reverse proxy, use "url": "https://media.example.com", "base": "/sonarr". Legato adds base before request, button, row action and row image paths, including login and title_from requests. Full HTTPS URLs stay unchanged. The base starts with / and cannot contain ?, # or ... A trailing slash is removed.

Self-signed certificates. A server at an IP address or a .local name can use one. The first time Legato meets it, the source fails with "certificate isn't trusted", and you trust it in Settings → Certificates. Legato then accepts only that certificate from that address and port. A page file can't trust a certificate.

One source can fill several kinds of card from the same answer: stats, lists and status cards alike. The source owns the polling interval. All its cards share the fetch and schedule, so adding a card does not add another request, and Legato checks for updates only while your Mac is awake and unlocked. With multiple named requests, one cycle makes each request once. The worked examples are complete pages; other snippets are explicitly labeled as fields or rules to place inside a page.

Supported APIs and limits

Use direct sources for simple GET/POST APIs with JSON request bodies, JSON, text, feed or Prometheus responses, static API credentials, one login request returning a token, or an OAuth client's ID and secret. Named requests run independently, with two exceptions: a request with each_row is sent once for each row of another request's answer, after it (and one more may be sent for each row inside those answers), and one with with takes a value from another request's answer, after it. There is no longer chain than that. A request with follow is one request sent again for each page of a list. A request with missing or optional is left out of the answer when it has nothing there yet or fails, instead of failing the source.

A source with no secret and no auth can also name a full https:// URL in requests, including another host. For example, "url": "https://api.open-meteo.com" with "requests": {"fc": "/v1/forecast?latitude={param.lat}&longitude={param.lon}&current=temperature_2m", "air": "https://air-quality-api.open-meteo.com/v1/air-quality?latitude={param.lat}&longitude={param.lon}&current=us_aqi"} lets one card read fc.current.temperature_2m and air.current.us_aqi. Params are filled and percent-encoded as for paths. Full URLs must use HTTPS, cannot contain a login, and cannot have method or body; they are GET requests with the usual timeout, size limit, headers and error handling. Both hosts appear in the page’s source summary and Source Preview; rate limits belong to each destination. A source with a secret can read one such URL too, from a request with "auth": { "type": "none" }, which goes without the source's sign-in or headers; see A public address beside the service.

OAuth sign-in through a browser for services other than those Legato connects to (an OAuth client is supported), cookie-based login, form or multipart bodies on reads and sign-ins (buttons can send a form), XML other than RSS and Atom feeds, automatic pagination and self-signed certificates on a host name other than a .local one are not supported, nor is a credential that has to go in the URL path. Services you may already use lists some that fit and some that don't. For those APIs, or for complex transformations, run an agent or script separately and have it write the finished page with legato set. Legato does not run that script. A Home Assistant template is executed by Home Assistant, not by Legato.

Choose an interval suited to the API's quota and how quickly the information changes. An hourly public-data poll is a better starting point than the one-minute minimum. Server-requested waits can delay the next attempt; conditional GETs can avoid downloading an unchanged response, but still make a request when due.

Notifications

A page notifies when one of its status, gauge or fleet cards moves up to warning or critical, whether the card's state comes from a source or is written in; see Notifications. A card still waiting for its source's first answer keeps the level it had, so a page waiting on its sources doesn't count as a recovery.

A page can also send a notification of its own with notify:

json
"notify": { "id": "backup-2026-10-24", "title": "Backup finished", "body": "1,204 files, 3.1 GB, in 4 minutes." }
  • Each id shows once. Save the file with a new id to notify again; saving it with the same one shows nothing more.
  • It's skipped when the file was last modified more than 24 hours before Legato sees it.
  • A notify that breaks the rules (no id or body, a body over 200 characters, a title over 60, or a key other than those three) stops the whole file loading: the page shows a warning card that says what's wrong, and its status file has ok: false. set_page and legato set refuse it with invalid_page and keep the old page.

A notification about a card also carries up to three of that card's buttons, so you can act on it from the notification. Only buttons that run without asking qualify: "kind": "open" buttons, and http buttons with a success check and no confirm. A button without a success check asks first in Shortcuts, and a notification can't ask, so it stays in the panel. Give a button a success check if you want it on the notification. See Notifications.

History

A source can keep rows from its answers on this Mac, for other pages to read later: deliveries a service forgets once they've arrived, readings it only reports as they are now. (To draw one number over time on a sparkline, use Sparkline readings instead.) Add collect to the source, saying which items to keep, which of their fields, under what key and for how long:

json
"collect": { "dataset": "parcel-deliveries", "each": ["active.deliveries", "recent.deliveries"],
             "key": "{carrier_code}:{tracking_number}",
             "fields": ["carrier_code", "tracking_number", "description", "events[].date", "events[].event"],
             "date": { "date": { "first": "date", "of": "events", "where": { "path": "event", "contains": "Delivered" } } },
             "keep": { "for": "400d" }, "readers": ["delivery-times"] }

A page listed in readers reads all matching rows with a source of its own, { "dataset": "parcel-deliveries" }, filtered to its period. The rows stay on this Mac and don't sync; Settings → History shows what each page keeps, and exports or deletes it. Agents and scripts can add rows too, with legato rows add, when the owner declares "accepts_rows": true. Changes to retained fields, text removal or date rules update previously kept rows while collection pauses; Settings offers Re-key when the key template changes.

For a reading over time of every item of a fleet, such as each monitor's state every 5 minutes, add "sample": { "every": "5m" }: History then keeps one row per item per interval, for a year unless keep says otherwise. See Samples.

A dataset source takes key to read one item's rows: { "dataset": "kuma-samples", "key": "{param.id}" } on a page for every item. The key is compared as text on both sides: kept keys are always text (collect refuses an item whose key is a number), and key is the text the link filled in, so "7" reads the item kept as 7 and "07" doesn't. A key a link didn't fill reads nothing, and the cards say "Open this page from an item's link".

A service that answers for a range of dates, such as Tessie's charges or GitHub's pull requests, doesn't need this: ask it for the period showing (see Dates in requests).

See History for every field, dates, retention, readers and a complete Parcel example.