# Integrating with 00Widget

You're an agent (Claude Code, Codex, etc.) working on a project that wants to **publish state to 00Widget** so it shows up on the operator's widgets, Lock Screen, Dynamic Island, and Apple TV dashboard.

This document is the entire contract you need. You do **not** need to read the rest of this repo. The 00Widget app and backend handle rendering — you just publish structured JSON.

## Choose the right connection

- **Publishing directly from Claude, ChatGPT, or another MCP host:** if the
  operator has enabled MCP, add `<BASE_URL>/mcp` as a custom connector and sign
  in. Use the exposed tools; call `get_status` before the first publish and
  `get_integration_guide` for the rendering rules relevant to the task. You do
  not need an API key or integration code.
- **Adding 00Widget to an app, script, service, automation, or repository:** use
  the REST API documented below. Ask the operator for the base URL and a
  publisher API key, then add the smallest possible publish path to the code.

Do not add MCP as an internal dependency merely because the code is being
written by an AI agent. MCP is the direct-host connection; HTTP+JSON is the
software integration.

## TL;DR for API integrations

- Set `00WIDGET_BASE_URL=https://api.00widget.com`; this hosted copy already knows the public Worker URL.
- Get `00WIDGET_API_KEY` from the operator.
- `POST <BASE_URL>/v1/cards/upsert` with `Authorization: Bearer <API_KEY>` and a card body to push state.
- If one producer snapshot creates multiple cards, send them together to `POST <BASE_URL>/v1/cards/upsert-batch`. Do not loop over the single-card endpoint.
- Use a **stable `id`** per card so re-publishing updates instead of duplicating.
- Pick a `template` (`summary`, `progress`, `list`, `action`, `chart`, `history`, `breakdown`, `briefing`, `timeline`) that matches the shape of the data you're surfacing.
- If the project has a dashboard, admin page, or useful detail page, set `deepLink` so a card tap opens it.
- Don't add a heavy SDK. A single `fetch` is enough.

## Tap behavior

Cards can open a destination when tapped via `deepLink`. Set it to an `https://...` URL, for example `"deepLink": "https://example.com/dashboard"`; other URL schemes are rejected.

On Apple TV, opening a card's detail panel renders the link as a QR code to scan with a phone; nothing on a television can follow it directly.

On Home Screen widgets, iOS first launches the containing 00Widget app with the widget URL. 00Widget then forwards the HTTPS deep link to the system, so a universal link can open its matching app and a normal web URL opens in Safari. You may briefly see 00Widget during that handoff; it is not an in-app web view. Inside the 00Widget app, the card is rendered as a normal link to the same URL. If `deepLink` is omitted, a widget tap just opens 00Widget with no external destination.

## Operator checklist for agents

- **Decide card or Live Activity first.** Standing state the operator checks on
  is a card. Work with a start and an end that you will report on while it runs
  — a build, a deploy, a test or capture run, a batch job — is a
  [Live Activity](#live-activities). It is the only surface that reaches the
  Lock Screen and Dynamic Island, where progress can be watched without opening
  anything; a card reaches a Home Screen widget on a rationed refresh budget
  (see [Rate limits](#rate-limits)). If you are about to spend minutes doing
  something and report on it, that is a Live Activity.
- Verify `00WIDGET_BASE_URL` with `/health` and `00WIDGET_API_KEY` with `GET /v1/status`, which also tells you whether any device can receive what you publish.
- If you start a Live Activity, check `pushToStartAttempted` in the response. `0` means no device can receive it, and nothing else will tell you.
- Pick one stable `id` per logical card.
- If the project has a dashboard, consider setting `deepLink`.
- Prefer common card fields: `id`, `template`, `title`, `status`, `icon`, `updatedAt`, `staleAfter`, `deepLink`.
- **Set `producer` to your own name.** An operator's dashboard carries cards
  from several agents, and the title alone does not say which one is claiming
  this card.
- If you need the operator to decide something, publish an attention `status`
  *and* an `actions` button. That pair is what earns the "Needs you" badge —
  [how it is derived](#asking-the-operator-to-step-in).
- If the thing has a due time, set `deadline` rather than writing the remaining time into `value` — the device keeps a `deadline` current between reloads and a string goes stale.
- Avoid secrets and private user data in card text; widgets can appear on the Lock Screen.

## Configure access

This hosted llms.md is being served by the 00Widget Worker you should call, so do not ask the operator for the base URL. Use:

```sh
00WIDGET_BASE_URL=https://api.00widget.com
```

Ask the operator only for the API key:

| Env var              | Example              | Where it comes from                         |
| -------------------- | -------------------- | ------------------------------------------- |
| `00WIDGET_API_KEY`   | a long random string | A tenant API token generated by the operator |

Verify the URL and API key before doing anything else:

```sh
curl -s "$00WIDGET_BASE_URL/health"
# → {"ok":true}

curl -s -H "Authorization: Bearer $00WIDGET_API_KEY" "$00WIDGET_BASE_URL/v1/cards"
# → {"cards":[...]}    (200, possibly empty)
# → {"error":"invalid API key"}   (401, key is wrong)
```

`GET /v1/cards` returns the full stored card JSON for that API token, including `deepLink` when present. If `/health` returns 200 but `/v1/cards` returns 401, the URL is right and the key is wrong. Ask the operator for the correct key — don't try to guess.

API tokens expire after 90 days of **inactivity**, not 90 days after creation. Every authenticated call slides the deadline forward on the existing token, so an integration that keeps publishing never needs re-keying and the token value never changes. A token only lapses if nothing uses it for 90 days. A `401` with `API key expired` therefore means this token has been idle that long and the operator must issue a replacement; do not keep retrying the expired credential. A token owner can revoke it and remove registrations associated with it using `DELETE /v1/auth/token` with the same Bearer header.

Tokens are capability-scoped. The agent publisher token has `read`,
`publish`, and `webhook:manage` — everything an agent needs. It cannot register
device push tokens, run confirmed actions, or manage shares; those belong to the
iOS app and use credentials it holds itself, which you are never given and never
need. A `403` naming a required scope means the operator must issue the right
credential; do not try to work around it with another endpoint.

A token minted through MCP is narrower still: `read` and `publish`, with
no `webhook:manage`. See [the MCP section](#if-your-host-speaks-mcp).

Guest links (`zwg_` tokens) are a fourth kind of credential you may encounter
but should never mint or handle: they carry only `guest:read`, unlock exactly
one card or one Live Activity instance, and cannot publish or run actions. They
are created by a person in the iOS app to share something read-only. If one is
ever handed to you as `00WIDGET_API_KEY`, the operator has given you the wrong
credential — say so rather than trying to publish with it.

## If your host speaks MCP

00Widget also exposes a Model Context Protocol server at `<BASE_URL>/mcp`, when
the operator has enabled it. It wraps the same endpoints as tools —
`upsert_card`, `upsert_cards_batch`, `list_cards`, `get_card`, `delete_card`,
`get_dashboard`, `get_status`, `start_live_activity`, `update_live_activity`,
`end_live_activity`, `list_live_activities`, and `get_integration_guide`. Everything below still
applies: the tool arguments *are* the JSON bodies documented here, validated by
the same schemas, and every field carries its description into the tool's JSON
Schema.

Call `get_status` before the first publish and check `setup`. A false
`delivery.canPushWidgets` means no widget can receive pushes; a configured
Horizon app can still read the dashboard directly.

Existing reads (`list_cards`, `get_card`, `list_live_activities`,
`get_dashboard`, `get_status`, and `get_integration_guide`) also return an
advisory `setup` object alongside their existing data. `setup.status` is:

- `ready`: native sign-in is recorded with a widget push token, a Live Activity
  start token refreshed within 30 days, or an active native Horizon app credential.
  An active entitlement is needed only if publishing requires one.
  Explicitly prepared reviewer accounts also return `ready`.
- `finish_setup`: native sign-in is recorded, but delivery or a required
  entitlement is incomplete.
- `unknown`: native sign-in evidence is missing. Ask whether the app is already
  configured; do not assume it is uninstalled or unconfigured.

This is optional help, never an access gate. Offer the instructions in `setup`:
Apple setup uses the App Store and the same Apple account; Horizon setup uses
the headset and its Meta account or linked Apple account. Complete setup in
the app, return to chat, keep the connector connected, and recheck with the
**same tool and arguments**. Installation alone cannot display this guidance;
it arrives only on an existing tool call. A headset polls directly and needs
no iPhone push permissions. Widget placement and current on-device permission
settings cannot be confirmed by the server.

The corresponding card, activity, dashboard and status HTTP reads carry the
same advisory. It includes no profile details, sign-in timestamps or identity
provider identifiers. Native Apple, Horizon and reviewer sign-ins record their
first successful exchange; browser, dashboard and connector sign-ins never do.
Backfill uses paired Apple device/app sessions or previously used native
Horizon credentials with a current Horizon binding. Revoked/expired records
remain historical evidence, with the earliest surviving timestamp retained.
Identity rows, subscriptions, labels and push registrations alone are insufficient.

`get_integration_guide` returns this document trimmed for a tool caller — the
rules the argument schemas cannot carry, without the credential setup, curl
invocations, and language snippets an MCP client has no use for. Pass
`section` (`essentials`, `cards`, `live-activities`, `actions`, `everything`)
to narrow it further or to read the whole thing.

Use it when the thing that wants to publish is an MCP client (ChatGPT, a Claude
connector, an editor). Do **not** reach for it when you are writing code — a
plain `fetch` to `/v1/cards/upsert` is simpler and needs no connector.

The transport is Streamable HTTP: one `POST` with a JSON-RPC body, one JSON
response, no SSE stream and no session id. `GET <BASE_URL>/mcp.json` returns a
ready-to-paste client config for whichever host is serving it.

**Webhook management is not part of MCP.** MCP tokens have `read` and `publish`,
so they may publish actions but get `403` on webhook administration. The
operator must register the selected named webhook (or `default`) with an API
token and retain its one-time signing secret.

Authorization is OAuth 2.1 rather than the `00WIDGET_API_KEY` used everywhere
else, because the clients that need MCP cannot send a custom API key header.
An unauthenticated request gets a `401` naming the metadata document, and the
client takes it from there; the account's owner then signs in and approves the
connection in a browser, which scopes it to their own account.
If you already hold an API token, ignore all of this and call `/v1/*` directly —
the MCP endpoint accepts the same `zw_` tokens, so an existing credential works
there too without any OAuth.

## Ask what your integration can actually reach

`GET /v1/status` answers, for the deployment in front of you, the questions
this document can only answer in general:

```sh
curl -s -H "Authorization: Bearer $00WIDGET_API_KEY" "$00WIDGET_BASE_URL/v1/status"
```

```json
{
  "account": {
    "tenantId": "tenant_…",
    "credentialKind": "publisher",
    "scopes": ["read", "publish", "webhook:manage"],
    "credentialExpiresAt": "2026-11-17T09:12:00.000Z"
  },
  "delivery": {
    "devices": 1,
    "widgetPushTokens": 3,
    "liveActivityStartTokens": 1,
    "liveActivityStartTokensRecentlyActive": 1,
    "canPushWidgets": true,
    "canStartLiveActivities": true,
    "widgetReloadMinSpacingSeconds": 300,
    "widgetReloadBurst": 6,
    "widgetReloadRefillSeconds": 1800,
    "secondsUntilNextWidgetReload": 412,
    "widgetPushApnsDiagnosticsEnabled": false
  },
  "published": { "cards": 5, "liveActivities": 1 },
  "attention": {
    "liveActivities": [
      {
        "externalActivityId": "ci-build-2026-04-26-1234",
        "secondsSinceUpdate": 1840,
        "staleAt": null,
        "reason": "no-stale-date"
      }
    ]
  },
  "features": { "sharing": true, "mcp": true },
  "subscription": { "enabled": false, "required": false },
  "rateLimits": [
    { "label": "Card upserts", "limit": 600, "remaining": 587, "resetAt": "2026-08-19T15:00:00.000Z" }
  ]
}
```

Worth one call at the start of an integration, and worth reading before
reporting a problem:

- **`canPushWidgets` / `canStartLiveActivities`.** `false` means what you
  publish is stored correctly and seen by nobody, because no device has
  registered to receive it. Tell the operator to open the 00Widget app and
  allow notifications; no amount of publishing will fix it.
- **`liveActivityStartTokens` / `liveActivityStartTokensRecentlyActive`.** The
  devices a Live Activity start is sent to, and how many of them have run the
  app in the last 7 days. A device that has not run it in 30 days is neither
  counted nor sent starts, and returns on its own when the app next launches.
  A gap between the two numbers is a device that is sent every start and may
  never show one.
- **`scopes`.** What this credential may do, without discovering it through a
  `403`.
- **`secondsUntilNextWidgetReload`.** How long before a Home Screen widget
  redraws. See [Rate limits](#rate-limits) for why this is not zero.
- **`widgetPushApnsDiagnosticsEnabled`.** When true, the deployment is
  temporarily persisting `widgetPushLastDeliveries`, one latest final APNs
  result per registered token. Use its status, reason, APNs id, attempts, and
  timestamp to separate server rejection from APNs-accepted/iOS-missed pushes.
- **`attention.liveActivities`.** Activities *you own* that have stopped
  telling the operator the truth. Empty when there is nothing to say, and
  activities other tenants shared with you are never listed — you cannot update
  those, so their silence is not yours. Two reasons, and they are different
  problems:
  - `past-stale-date` — the safety net worked. iOS is already drawing this as
    out of date, so nobody is being misled, but a run that outlived its own
    estimate needs updating or ending.
  - `no-stale-date` — the dangerous one. This activity was never given a
    `staleAt`, so nothing will ever mark it stale and a Lock Screen shows its
    last state as current for as long as it exists. Send `staleAt` on the next
    update. Only reported once an activity has been quiet for five minutes, so
    a run that has just started is not flagged. Setting `staleAt` suppresses it
    however long you then go between updates.
- **`rateLimits`.** Only windows this account has touched appear; anything
  absent is untouched and has its full allowance.
- **`subscription`.** Whether this deployment sells subscriptions at all, and
  whether it refuses writes without one.

It needs only `read`, and it is never refused for a lapsed subscription — a
lapsed account is exactly the one that needs to find out why its writes are
failing.

## Data model

A **DashboardCard** is one tile on a widget. Wire format:

```json
{
  "id": "string (stable per logical thing)",
  "template": "summary | progress | list | action | chart | history | breakdown | briefing | timeline",
  "title": "string",
  "subtitle": "short string? (one line; truncates rather than wraps; essential context first)",
  "value": "string? (headline already formatted for a person, including any prefix such as $)",
  "unit": "string? (suffix rendered after value, such as kW, %, jobs)",
  "status": "unknown | good | warning | critical | running | finished | paused | offline",
  "icon": "SF Symbol name? (e.g. sun.max, bolt.car, flame, washer, creditcard)",
  "statusIcon": "SF Symbol name? (secondary glyph for a runtime status — e.g. bolt.fill while boosting, arrow.up while charging; rendered on every widget size, including grid cells)",
  "producer": "CardProducer? ({label, icon?} — which agent or automation publishes this card)",
  "comparison": "CardComparison? ({value, label, signal?} — the change beside the headline, e.g. +18 vs Monday)",
  "priority": "integer? (higher sorts first; absent counts as 0)",
  "progress": "number? 0.0-1.0 (the bar on a progress card; also fills the circular Lock Screen gauge and a grid cell on any template)",
  "updatedAt": "ISO-8601 timestamp? (server fills in if omitted)",
  "staleAfter": "ISO-8601 timestamp? (after this, widget shows a 'stale' state)",
  "deadline": "ISO-8601 timestamp? (drawn as a live countdown the device ticks)",
  "deepLink": "HTTPS URL? (tapping the card opens this destination)",
  "items": "DashboardItem[]? (list rows, history pips, breakdown segments)",
  "chart": "DashboardChart? (drawn by template=chart; ignored by other templates except in a grid cell)",
  "timeline": "DashboardTimeline? (irregular timestamped events and spans inside a fixed observation window)",
  "briefing": "DashboardBriefing? (ordered plain-text details revealed as room permits)",
  "actions": "ActionDefinition[]? (buttons on any template, not just action; safe-only from widgets)"
}
```

The card's `subtitle` is a label, not a sentence. It renders on one line and
truncates rather than wrapping on widgets, including large chart widgets with
plenty of room below the headline. Aim for about 40 characters, put the
information a truncated label must preserve first, and omit words already said
by the title. Prefer `"$300 baseline · Mar–Aug 2026"` to `"Consensus target ·
Mar–Aug 2026 · AAPL baseline $300"`: the latter loses the number that explains
the chart when its end is cut off.

`unit` is always a suffix. Use it for `kW`, `%`, `jobs`, and similar labels. A
prefix such as a currency symbol belongs in the already-formatted `value`: send
`"value": "$338.99"` with no `unit`. Do not send a bare `"338.99"` value with
`"unit": "$"`, which renders as `338.99 $`.

**CardProducer** (`producer` — who published the card):

```json
{
  "label": "string (the agent or automation's own name, e.g. Release Agent)",
  "icon": "SF Symbol name? (drawn beside the label)"
}
```

An operator's dashboard fills up with cards from several agents, and a title
like "Build" does not say which of them is claiming it. `producer` is that
attribution, drawn on a second line under the title. Use **your own name** —
the agent doing the publishing — not the vendor whose data you relay: "Release
Agent", not "GitHub".

Only surfaces with room for it draw it: the iOS app, Apple TV, a shared link's
web page, and large and extra-large widgets. Small and medium widgets, Lock
Screen accessories, and grid cells drop it, so never put anything the card needs
in `producer`. The web page shows the label alone — `icon` names an SF Symbol,
which a browser cannot resolve.

Now that the name has somewhere structured to live, keep it out of `subtitle`.
A subtitle shaped `"Growth Agent · up 18 this week"` next to a `producer` of
"Growth Agent" spends two of a card's few lines saying one thing; send
`"up 18 this week"` and let the attribution be the attribution.

**CardComparison** (`comparison` — the change beside the headline):

```json
{
  "value": "string (the already-formatted change, e.g. +18 or -12%)",
  "label": "string (what it is compared with, e.g. vs Monday)",
  "signal": "favorable | neutral | caution | unfavorable (default neutral)"
}
```

The headline says where something is; `comparison` says which way it moved, on
the line under it. Both halves are formatted by you — the device never computes
a delta, so send the sign you want shown.

`signal` is what the change *means*, not which way it points, and the two come
apart constantly: `+18` trials is `favorable`, `+18` errors is `unfavorable`,
`-12%` spend is `favorable` again. Pick it from the reading or the card draws a
green arrow over bad news. Omitted, it draws `neutral`.

Unrelated to a chart's `delta` style, which controls bar geometry; a card may
carry both.

**DashboardItem** (rows inside a `list` card):

```json
{
  "id": "string",
  "title": "string",
  "subtitle": "string?",
  "value": "string?",
  "unit": "string?",
  "status": "DashboardStatus?",
  "semantic": "{role?, flow?}? (meaning of the quantity, never presentation colors)",
  "amount": "number? (magnitude, for templates that draw items)",
  "deepLink": "HTTPS URL? (tapping this row opens it, instead of the card's)"
}
```

`amount` is the row's magnitude, and it is deliberately not `value`: `value` is
a display string (`"12.40"`, `"3m 51s"`, `"Rinse"`) and parsing it back into a
number would have to guess at your locale and formatting. Send both — `amount`
for the drawing, `value` for the label.

Items may reuse the metric `role` (`actual`, `forecast`, `baseline`, `target`,
`capacity`, `balance`, `remainder`) and `flow` (`inbound`, `outbound`) hints used
by charts. Clients choose any color/emphasis and also draw and speak direction,
so the hint still works without color. Item semantics deliberately omit
`signal`: keep row health, lifecycle, or outcome in the existing `status` field
instead of publishing the same meaning twice.

A `list` draws as many rows as the canvas it lands on has room for, measured at
render time rather than fixed per widget size: a small widget shows a few, a
large one up to a dozen, and fewer of each once buttons, a deadline, or a large
text size have taken their share. The rows spread over the card rather than
crowding under the header. So order `items` most important first — what a
smaller canvas drops is the tail.

In a `list`, giving items an `amount` turns the rows into ranked bars: each row
gets a bar behind it, measured against the largest amount in the card, so five
rows can be compared at a glance instead of read one number at a time. Top
processes by memory, spend by category, points by player. It is the same field
`breakdown` uses, measured differently — against the widest row rather than
against the total — because a list ranks things against each other where a
breakdown divides a whole. Leave `amount` off and a `list` stays a plain list.

A `history` card reuses `items` rather than adding a field of its own: each
item is one past outcome, **oldest first**, and its `status` is what gets drawn
— a row of colored pips, most recent on the right. Nothing numeric is involved,
which is the point: builds, backups, uptime checks, and doses taken have
outcomes, not values, and flattening pass/fail into 1/0 draws a plot that reads
like a trend when it is really a tally.

Send around 10. The limit is the 20-item card limit, but a small widget shows
the last 10 and the Lock Screen accessory the last 12; a history longer than
that loses its oldest entries first. Give each item a `title` (`"#482"`,
`"Tue"`) and optionally a `value` (`"4m 12s"`) — the app lists them under the
strip, and the widget uses only the statuses.

**DashboardTimeline** (the events behind a `timeline` card):

```json
{
  "startAt": "ISO-8601 beginning of the observation window",
  "endAt": "ISO-8601 end of the observation window",
  "lanes": "1-3 entries ({id, label})",
  "series": "1-4 event kinds ({id, label, icon?})",
  "entries": "1-60 events ({id, laneId, seriesId, at, endAt?, label?, status?})"
}
```

A timeline is for facts that are separated by real elapsed time: motion,
doors opening, incidents, deploys, charging sessions, manual overrides, or
machine state changes. `at` alone is an instant; adding `endAt` makes it a
duration. A chart is different: its numeric points are evenly spaced, and a
history strip is different again: it preserves outcome order but not time.

Publish one fixed window and replace the whole thing on every upsert. 00Widget
sorts entries oldest first and never appends history. Events may touch either
edge and spans may begin before or finish after the window; renderers clip
them. An entry wholly outside the window is rejected. `laneId` and `seriesId`
must reference declared unique ids, and a span's `endAt` cannot precede `at`.

Lanes name the subjects being observed; series name what happened. Keep both
generic and semantic. Do not encode colours, dash patterns, coordinates, or a
provider-specific UI in the payload. The renderer assigns a stable colour and
marker from series order and adds non-colour differentiation. Put the current
conclusion in the card's `value`, `subtitle`, and `status` — older clients treat
the unknown template as a summary, and the smallest accessories intentionally
show that fallback rather than an unreadable plot.

```json
{
  "id": "home-activity",
  "template": "timeline",
  "title": "Home activity",
  "value": "Likely home",
  "subtitle": "Last motion 29 min ago",
  "status": "good",
  "timeline": {
    "startAt": "2026-09-15T10:00:00Z",
    "endAt": "2026-09-15T16:00:00Z",
    "lanes": [
      {"id":"override","label":"Override"},
      {"id":"house","label":"Whole house"}
    ],
    "series": [
      {"id":"motion","label":"Motion","icon":"figure.walk"},
      {"id":"front-door","label":"Front door","icon":"door.left.hand.open"},
      {"id":"quiet","label":"Quiet","icon":"moon.zzz.fill"}
    ],
    "entries": [
      {"id":"motion-1","laneId":"house","seriesId":"motion","at":"2026-09-15T10:31:00Z"},
      {"id":"quiet-1","laneId":"override","seriesId":"quiet","at":"2026-09-15T11:12:00Z","endAt":"2026-09-15T12:25:00Z","label":"No movement"}
    ]
  }
}
```

A `breakdown` card draws `items` as one bar split into proportional segments —
where the month's spend went, what is filling the disk, how a vote split. Each
item needs an `amount`; the shares are computed from their sum, so you never
send percentages. Negative amounts count as zero rather than being dropped,
which keeps every other segment measured against the same total.

Segments step down in opacity from the card's tint, so a breakdown reads as one
quantity divided up rather than as unrelated categories. An item that sets its
own `status` takes that color instead — that is how you mark the slice that is
the problem. This is a bar and not a pie on purpose: a pie needs a legend, and a
legend does not fit a small widget.

**DashboardChart** (the series behind a `chart` card):

```json
{
  "points": "number[] (2-60 values, oldest first; derived when series or ranges is sent)",
  "min": "number? (pins the bottom of the plot)",
  "max": "number? (pins the top of the plot)",
  "reference": "number? (target/budget/threshold, drawn as a dashed rule)",
  "referenceMetadata": "{label?, semantic?}? (meaning for reference)",
  "semantic": "MetricSemantic? ({role?, flow?, signal?})",
  "style": "line | bar | delta | range (default: line)",
  "labels": "string[]? (category labels aligned with points)",
  "categories": "DashboardChartCategory[]? ({id, label, signal?}, aligned with points)",
  "series": "DashboardChartSeries[]? (1-4 non-negative bar series)",
  "stacking": "stacked | grouped (default: stacked)",
  "ranges": "DashboardChartRange[]? ({low, high, value?}, 2-60 entries)",
  "rangeValueLabel": "string? (meaning shared by supplied range value markers)"
}
```

Points are plotted evenly spaced in the order given. There are no timestamps;
optional `labels` are short display strings such as `Mon` or `Aug`. Small
surfaces omit them, while large widgets and detail views show a readable
subset. Send a fixed-length rolling window (the last 24 hours, 30 days, 60
builds), oldest first.

Send the resolution the data actually has, up to 60. The wide surfaces — medium
and large widgets, the iPad and full-page families, the app, Apple TV, the Lock
Screen Live Activity — draw every point. The narrow ones cannot fit 60 legibly,
so they average the series into as many evenly spaced buckets as they have room
for: 32 on a small widget, 24 on a Lock Screen accessory, 16-24 in a grid cell.
The window and its direction are always what you sent; what a narrow surface
gives up is amplitude, so a brief spike reads as a smaller bump there than on a
large widget. If the peaks matter more than the resolution, publish fewer,
already-aggregated points instead.

Without `min`/`max` the plot scales to the series, so it always fills the card
and a flat-but-noisy series looks dramatic. Send both — or at least `min: 0` —
whenever the absolute scale is the point, such as a percentage or a 0-100
score. Values outside an explicit range are clamped, not dropped.

For stacked or grouped vertical bars, send `series` instead of `points`. A
single entry gives one named series; multiple entries are stacked or grouped. Every
series has a stable `id`, short legend `label`, and the same number of
non-negative points. `stacking: "stacked"` adds the values into one column per
category; `grouped` places them side by side. The server defaults `min` to zero
for these magnitude bars, then derives and stores
`points` as the per-category totals. An older client ignores the new fields and
still draws one truthful total bar per category.

The chart itself and each named series may carry a composable `semantic`
object. These are meaning hints, never literal colors:

```json
{
  "role": "actual | forecast | baseline | target | capacity | balance | remainder",
  "flow": "inbound | outbound",
  "signal": "favorable | neutral | caution | unfavorable"
}
```

Use only the dimensions you know. `role` tells the renderer whether a series
is observed, predicted, a comparison, a limit, or stored/remaining quantity.
`flow` describes movement relative to the system being measured — charging a
battery is inbound and discharging it is outbound. `signal` is the producer's
contextual interpretation. It is deliberately not `high` or `low`: an expensive
period is unfavorable to a consumer and favorable to an exporter, so the
producer must state the perspective rather than expect the client to guess.

Put `semantic` on the chart for an ordinary `points`, `delta`, or `ranges`
plot. In a multi-series chart it becomes the default: each series inherits the
dimensions it omits and overrides only what it states. For example, put
`{"role":"forecast"}` on the chart and only the distinct `flow` on each
series. This keeps shared meaning in one place without losing per-series
specificity.

Renderers own every actual color, opacity, pattern, symbol, and accessibility
treatment. Missing hints retain the deterministic palette. Current Apple
clients also speak the semantic words, show direction arrows, vary emphasis by
role, and pair category tones with non-color symbols. Never encode colors into
an id or label.

Use `categories` when meaning changes per bar rather than per series — tariff
periods are the canonical example. Each category has a stable `id`, a short
`label`, and an optional `signal`. The server derives and stores the legacy
`labels` array from categories. Older clients ignore categories and semantics,
retain those labels, and continue drawing the same aggregate bars or fallback
line.

For a min/max envelope, forecast band, confidence interval, or observed daily
range, send `ranges` instead of `points`. Every entry has `low` and `high`, plus
an optional representative `value` marker inside the interval. When any entry
has a `value`, send `rangeValueLabel` once on the chart to say exactly what
those markers mean — for example `Daily average`, `Median`, `Best estimate`, or
`Current`. The client never guesses that meaning from the number. If there is
no actual representative reading, omit `value`; new detail views show only the
low and high rather than presenting a derived midpoint as observed data.
`style` defaults to `range`.
The server derives and stores one compatibility point per entry: `value` when
present, otherwise the midpoint. Older clients ignore `ranges` and the unknown
style, fall back to their line renderer, and still show that representative
series. New clients draw translucent floating columns with a marker for each
supplied value. `rangeValueLabel` is additive: older clients ignore it.

`style` picks how the series is drawn. `line` is a sparkline with a soft area
fill; `bar` grows every bar from the bottom of the range; `delta` anchors the
bars at zero instead, so signed values grow up or down from a zero rule — net
grid import/export per hour, commits added and removed, spend against refunds;
`range` draws floating low/high bands and optional publisher-defined value markers.
A `delta` chart always includes zero in its range unless you pin both edges away
from it, in which case the bars fall back to plain magnitudes and no zero rule
is drawn.

`reference` draws a dashed rule across the plot: a target, a budget, an SLO, a
"same week last year". It is usually the difference between a trend you can read
and a trend you can act on, because "above or below the line" needs no axis
labels. An unpinned edge stretches to keep the rule visible; if you pin both
`min` and `max` and the reference falls outside them, it is not drawn at all
rather than being clamped to an edge it does not belong on. Add
`referenceMetadata` to name and semantically describe the rule on larger
surfaces and to accessibility clients:

```json
{
  "reference": 20,
  "referenceMetadata": {
    "label": "Daily target",
    "semantic": {"role": "target"}
  }
}
```

The rule itself has no numeric label on the smallest surfaces. When its exact
value matters, lead the card's short `subtitle` with its formatted meaning and
value — for example, `"SLO 5m · last 10 runs"` for `reference: 300`, or
`"$300 baseline · Mar–Aug 2026"` for a price chart. Older clients ignore the
metadata and keep drawing the same numeric reference.

Keep publishing the card's `value` too: it is the headline number every widget
size shows above the plot, and the only thing the inline Lock Screen accessory
can render.

**ActionDefinition** (buttons on an `action` card):

```json
{
  "id": "string",
  "label": "string",
  "role": "normal | destructive (default: normal)",
  "confirm": "boolean (default: false)",
  "confirmation": {"title": "string", "message": "string"},
  "webhookId": "string? (write-only named destination; default when omitted)",
  "payload": "Record<string,string>? (write-only server-side context)"
}
```

Only `role: normal` + `confirm: false` actions can run from widgets. Anything else routes through the iOS app for confirmation. Don't make destructive actions auto-runnable.

`confirmation` is optional custom copy for that foreground prompt. Use it to
name the real consequence instead of restating the button label. Older actions
remain compatible; the app falls back to a truthful sentence naming the action,
card, and producer when available.

`payload` is accepted only when publishing a card. The server extracts it into private action storage and omits it from the stored card JSON, API responses, shared cards, and device caches. When the action runs, the server adds the private payload to the signed webhook delivery. Treat card reads as a public rendering model: they will never return this field.

## Size limits

00Widget stores compact widget state, not logs or arbitrary documents. Oversized requests return `400 validation failed` or `400 invalid JSON body`.

Request body limits:

| Endpoint group | Limit |
| -------------- | ----: |
| `POST /v1/cards/upsert` | 32 KiB |
| `POST /v1/cards/upsert-batch` | 128 KiB, at most 32 cards |
| Live Activity start/update/end | 16 KiB |
| Device, widget token, and Live Activity token registration | 8 KiB |
| Action runs, webhook integration, and share requests | 4 KiB |
| Apple app login token exchange | 16 KiB |

Card field limits:

| Field | Limit |
| ----- | ----: |
| `id` | 96 chars, `[A-Za-z0-9._:-]` only |
| `title` | 120 chars |
| `subtitle` | 240 chars |
| `value` | 80 chars |
| `unit` | 24 chars |
| `icon` | 64 chars |
| `statusIcon` | 64 chars |
| `producer.label` | 240 chars |
| `producer.icon` | 64 chars |
| `comparison.value` | 80 chars |
| `comparison.label` | 240 chars |
| `priority` | integer |
| `deadline` | ISO-8601 timestamp |
| `deepLink` | HTTPS URL, 2048 chars |
| `items` | 20 rows |
| `progress` | number, 0.0–1.0 |
| `chart.points` | 2–60 finite numbers |
| `chart.series` | 1–4 series; 2–60 non-negative points each |
| `chart.categories` | 2–60 unique ids, aligned one-for-one with points |
| `chart.ranges` | 2–60 entries; `low <= high`, optional `value` inside the interval |
| `chart.rangeValueLabel` | 60 chars; requires at least one `ranges[].value` |
| `chart.min`, `chart.max`, `chart.reference` | finite numbers |
| `timeline.lanes` | 1–3 entries with unique ids |
| `timeline.series` | 1–4 entries with unique ids |
| `timeline.entries` | 1–60 entries with unique ids and ISO-8601 dates |
| timeline labels | 60 chars |
| `actions` | 8 buttons |

Dashboard item limits match card text limits: `id` 96 chars, `title` 120 chars, `subtitle` 240 chars, `value` 80 chars, and `unit` 24 chars. An item `deepLink` is an HTTPS URL up to 2048 chars, like a card's.

A row with its own `deepLink` opens that instead of the card's. Only medium and
large Home Screen widgets can address a single row — everywhere smaller the
whole card is one tap target, so the card's own link is what opens. The app and
a shared link both honour per-row destinations.

Action payload limits:

| Field | Limit |
| ----- | ----: |
| `id` | 96 chars, `[A-Za-z0-9._:-]` only |
| `label` | 80 chars |
| `payload` keys | 16 keys |
| payload key | 64 chars |
| payload value | 512 chars |
| total serialized `payload` | 4 KiB |

Live Activity limits:

| Field | Limit |
| ----- | ----: |
| `externalActivityId` | 128 chars |
| `title` | 120 chars |
| `subtitle` | 240 chars |
| `state` | 120 chars |
| `icon` | 64 chars |
| `statusIcon` | 64 chars |
| `value` | 80 chars |
| `unit` | 24 chars |
| `deepLink` | HTTPS URL, 2048 chars |
| `alert.title` | 120 chars |
| `alert.body` | 240 chars |
| `items` | 6 rows |

Live Activity item limits match the corresponding top-level text limits: `id`
96 chars, `title` 120 chars, `subtitle` 240 chars, `icon` and `statusIcon` 64
chars, `value` 80
chars, and `unit` 24 chars. Each item may also include `progress` (`0.0`–`1.0`)
and `status`. Item ids must be unique within the activity. A `chart` on an activity costs roughly 100 bytes
of that budget at ten points, and 300-600 at sixty depending on how many
decimals the numbers carry — round them before sending if the activity is
otherwise full. ActivityKit limits
the combined encoded static attributes and dynamic content state to 4 KiB;
00Widget rejects a start or update that would exceed it.

Registration and integration limits:

| Field | Limit |
| ----- | ----: |
| `deviceId` | 128 chars |
| `widgetKind` | 128 chars |
| `attributesType` | 128 chars |
| APNs push token fields | 4096 chars |
| `appVersion` | 64 chars |
| `platform` | 32 chars |
| `recipientEmail` | 254 chars |
| webhook id | 96 chars; letters, digits, `.`, `_`, `:`, and `-` only |
| webhook URL | 2048 chars and must be public `https` |

## Choosing a template

First check you want a card at all. A template describes **standing state** —
something with a current value the operator checks on. Work that starts, runs
and finishes, and that you will report on as it goes, belongs on a
[Live Activity](#live-activities) instead; `progress` is the template that most
often gets picked for a job by mistake, because it is the first thing in this
table that sounds like one.

Then pick one based on the *shape* of the data, not the domain:

| Source feels like…                    | Template   | Required fields                            |
| ------------------------------------- | ---------- | ------------------------------------------ |
| One headline number or short state    | `summary`  | `title`, usually `value`, `unit`, `status` |
| Something filling up over time        | `progress` | `title`, `progress` as `0.0–1.0`           |
| 2–6 things with their own values      | `list`     | `title`, `items[]`                         |
| …the same, ranked against each other  | `list`     | as above, plus an `amount` per item        |
| One or more buttons                   | `action`   | `title`, `actions[]`                       |
| One number moving over time           | `chart`    | `title`, `chart.points[]`, usually `value` |
| Discrete readings as vertical bars    | `chart`    | as above, plus `chart.style: "bar"`       |
| One number swinging above and below 0 | `chart`    | as above, plus `chart.style: "delta"`      |
| A low/high interval per category      | `chart`    | `chart.ranges[]`; optional `labels[]`       |
| Periods with contextual meaning       | `chart`    | `chart.categories[]` with optional `signal` |
| A run of pass/fail outcomes           | `history`  | `title`, `items[]` each with a `status`    |
| A whole split into parts               | `breakdown`| `title`, `items[]` each with an `amount`   |
| A conclusion with explanatory prose    | `briefing` | `value`, `subtitle`, `briefing.sections[]` |
| Irregular events or duration spans      | `timeline` | `value`, `subtitle`, `timeline`            |

If unsure, default to `summary` — it degrades gracefully on every widget size.

### Text briefings reveal progressively

A `briefing` is for conclusions, causes, impact, and next steps rather than a
numeric visualization. Put the conclusion in `value` and its first explanation
in `subtitle`: those are what a small widget shows, and they are also what an
older app renders when it treats the future template as `summary`.

Put the remaining detail in `briefing.sections`, ordered most important first.
Each section is self-contained plain text with a stable `id` and an optional
short `label`. Do not send Markdown. Medium widgets show the first section,
large widgets show more, and the app and Apple TV detail panel can show all of
them. This progressive structure avoids maintaining compact, standard, and
detailed rewrites that can contradict one another.

```json
{
  "id": "release-briefing",
  "template": "briefing",
  "title": "Release",
  "value": "2 blockers",
  "subtitle": "Payments deploy needs attention",
  "status": "warning",
  "briefing": {
    "sections": [
      {"id":"cause","label":"Cause","text":"The database migration is waiting for production approval."},
      {"id":"impact","label":"Impact","text":"Checkout is unaffected, but the refund fix has not shipped."},
      {"id":"next","label":"Next","text":"Approve migration 1842, then retry the payments deployment."}
    ]
  }
}
```

### Buttons combine with any template

`actions` is not tied to `template: action`. Every template renders its buttons
underneath its own visual, so a `chart` card can plot the last hour of latency
*and* offer a Retry button, and a `list` card can offer one per snapshot.
`action` is simply the template with no visual of its own — pick it when the
buttons are the whole card, not because you need buttons at all.

How many are drawn depends on the surface, so order them most useful first:

| Surface                          | Buttons drawn |
| -------------------------------- | ------------- |
| Small widget                     | 1             |
| Medium widget                    | 2             |
| Large and extra-large widget     | 4             |
| iOS app card                     | all of them   |
| Apple TV card detail             | all of them   |
| Apple TV dashboard grid          | none          |
| Grid widget cell                 | none          |
| Lock Screen accessories          | none          |

A widget the operator has set to **Compact** density draws one fewer than the
table says, and none at all on a small one. On Apple TV the dashboard grid is a
summary: pressing Select on a card opens a detail panel, and that is where its
buttons are — along with a QR code for its `deepLink`, since a television can do
nothing else useful with a link. Cards reaching a device through a
share or a guest link have their `actions` stripped by the server, so a card you
expect other people to view through a link should not depend on them.

The reverse does **not** hold: `chart` is drawn only by `template: chart`. An
`action` card carrying a `chart` renders its buttons and silently ignores the
series everywhere except a grid cell and the guest web page. If you want a plot
and a button, publish `template: chart` with `actions[]` — not the other way
round.

`progress` sits in between. It draws a bar on `template: progress` (and on a
`summary` card at large widget sizes), and it fills the circular Lock Screen
gauge and a grid cell's band on any template. It does not add a bar to a `list`
or `chart` card's main layout.

## Publishing a card

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "id": "build-status",
    "template": "summary",
    "title": "Build",
    "subtitle": "main is green",
    "status": "good",
    "icon": "checkmark.seal",
    "deepLink": "https://example.com/dashboard"
  }'
```

200 with `{ "card": {...} }` means it landed. Re-POST with the same `id` to update — there's no separate update endpoint and no need to delete first.

### Publishing multiple cards from one snapshot

When a poll, cron run, webhook, or agent turn produces more than one related card, use the batch endpoint. It validates and stores the cards together, returns `{ "cards": [...] }`, and makes one coalesced WidgetKit reload decision for the whole snapshot. This is the preferred integration whenever several cards describe one producer snapshot.

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert-batch" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "cards": [
      {"id":"api-status","template":"summary","title":"API","value":"Healthy","status":"good"},
      {"id":"queue-depth","template":"summary","title":"Queue","value":"12","unit":"jobs","status":"running"},
      {"id":"database-status","template":"summary","title":"Database","value":"Healthy","status":"good"}
    ]
  }'
```

Card ids must be unique within the batch. The per-card schema and stable-id rules are identical to the single-card endpoint. Keep the single-card endpoint for genuinely independent updates; never implement a multi-card snapshot as `Promise.all(cards.map(upsert))`.

#### Letting a snapshot shrink

Publishing only ever adds. A producer that stops reporting something, or
renames its ids, leaves the old cards on the operator's Home Screen forever —
and only the operator can remove them.

Send `replacePrefix` with your own id namespace and the batch becomes the whole
truth for that namespace: anything under the prefix that the snapshot does not
contain is deleted.

```json
{
  "replacePrefix": "myapp-",
  "cards": [
    {"id": "myapp-api", "template": "summary", "title": "API", "value": "Healthy"},
    {"id": "myapp-queue", "template": "summary", "title": "Queue", "value": "12"}
  ]
}
```

If `myapp-database` existed before that call, it is gone after it, and the
response says so:

```json
{ "cards": [ ... ], "removed": ["myapp-database"] }
```

Two rules keep it from being dangerous. **Every card in the batch must start
with the prefix** — otherwise a mistyped `replacePrefix` would publish
everything and then clear a namespace nothing in the request belongs to, which
looks exactly like success. And the prefix scopes the deletion, so one
producer's snapshot can never sweep away another's cards on the same account.
Use the namespace you already publish under; if you have not been namespacing
your ids, start before you use this.

To verify the stored card, including `deepLink`, call:

```sh
curl -s -H "Authorization: Bearer $00WIDGET_API_KEY" "$00WIDGET_BASE_URL/v1/cards/build-status"
# → {"card":{"id":"build-status", ...}}
```

Every read on this API answers with a single-key object — `{"card":{...}}`,
`{"cards":[...]}`, `{"activities":[...]}` — never a bare object or a bare
array, so there is no shape to fall back to and nothing to parse defensively.

To remove a card:

```sh
curl -X DELETE "$00WIDGET_BASE_URL/v1/cards/build-status" \
  -H "Authorization: Bearer $00WIDGET_API_KEY"
```

### Publishing progress

`progress` is the fraction, `0.0`–`1.0`. `value` is the label shown above the
bar, so a progress card says how far along it is *and* what that means:

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "id": "test-suite",
    "template": "progress",
    "title": "Test suite",
    "subtitle": "integration",
    "value": "184 of 240",
    "progress": 0.767,
    "status": "running",
    "icon": "checklist"
  }'
```

Older integrations put the fraction in `value` itself, and that still works —
a `progress` card with no `progress` field parses `value` as a number, reading
anything above `1` as a percentage. Don't write new code that way: it means the
card can show a bar or a headline number, never both, and `"1"` and `"1%"` are
indistinguishable.

`progress` is accepted on any template, not only this one. It is ignored where
there is nowhere to draw it.

### Publishing a breakdown

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "id": "disk-usage",
    "template": "breakdown",
    "title": "Disk",
    "subtitle": "912 GB used of 1 TB",
    "value": "89",
    "unit": "%",
    "status": "warning",
    "icon": "internaldrive",
    "items": [
      {"id": "media", "title": "Media", "value": "512 GB", "amount": 512},
      {"id": "backups", "title": "Backups", "value": "280 GB", "amount": 280},
      {"id": "system", "title": "System", "value": "120 GB", "amount": 120},
      {"id": "free", "title": "Free", "value": "112 GB", "amount": 112, "semantic":{"role":"remainder"}}
    ]
  }'
```

### Publishing a run history

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "id": "ci-history",
    "template": "history",
    "title": "CI",
    "subtitle": "Last 10 runs on main",
    "value": "9/10",
    "status": "warning",
    "icon": "arrow.triangle.2.circlepath",
    "items": [
      {"id": "473", "title": "#473", "value": "3m 51s", "status": "good"},
      {"id": "477", "title": "#477", "value": "1m 04s", "status": "critical"},
      {"id": "482", "title": "#482", "value": "4m 12s", "status": "good"}
    ]
  }'
```

Republish the whole window each time, oldest first, the same way a `chart`
does. The card's own `status` should summarize the strip — `warning` when a
recent run failed, `good` when the window is clean — because that is what the
badge and the tint on every widget size read from.

### Publishing a chart

Republish the whole window on every update — there is no append endpoint, and a
`chart` card holds only what you last sent.

Use `style: "bar"` for vertical columns rather than a line. `min` and `max`
pin the y-axis, while `reference` adds a dashed target without changing the
data. Use `style: "delta"` when signed values must grow above and below zero,
and `style: "range"` for floating low/high intervals.

Multi-series bars default to `style: "bar"` and `stacking: "stacked"`, so both
may be omitted. Use the explicit form when it makes the producer's intent
easier to audit:

```json
{
  "style": "bar",
  "stacking": "stacked",
  "semantic": {"role":"actual"},
  "categories": [
    {"id":"mon","label":"Mon","signal":"favorable"},
    {"id":"tue","label":"Tue","signal":"neutral"},
    {"id":"wed","label":"Wed","signal":"caution"}
  ],
  "min": 0,
  "max": 30,
  "series": [
    {
      "id":"solar",
      "label":"Solar",
      "points":[12,14,9],
      "semantic":{"flow":"inbound","signal":"favorable"}
    },
    {
      "id":"grid",
      "label":"Grid",
      "points":[8,6,11],
      "semantic":{"flow":"inbound","signal":"neutral"}
    }
  ]
}
```

Range charts likewise derive their compatibility points and default their
style, so this is sufficient:

```json
{
  "labels": ["Mon", "Tue", "Wed"],
  "min": 0,
  "max": 30,
  "rangeValueLabel": "Expected daytime",
  "ranges": [
    {"low": 12, "high": 21, "value": 18},
    {"low": 10, "high": 19, "value": 16},
    {"low": 13, "high": 24, "value": 20}
  ]
}
```

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/cards/upsert" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "id": "deploy-duration",
    "template": "chart",
    "title": "Deploys",
    "subtitle": "SLO 5m · last 10 runs",
    "value": "4m 12s",
    "status": "good",
    "icon": "chart.bar.xaxis",
    "chart": {
      "points": [386, 402, 351, 498, 441, 370, 362, 415, 288, 252],
      "min": 0,
      "max": 600,
      "reference": 300,
      "style": "bar"
    }
  }'
```

#### Every date is a full timestamp

`updatedAt`, `staleAfter`, and the Live Activity `endsAt`, `staleAt`, and
`dismissalDate` all take an ISO-8601 instant with **seconds and an offset**:

```
2026-04-26T18:45:00Z          ✅
2026-04-26T18:45:00.123Z      ✅  fractional seconds are fine
2026-04-26T19:45:00+01:00     ✅  any offset, not just Z
2026-04-26T18:45:00           ❌  no offset
2026-04-26                    ❌  no time
```

A shorter form is rejected with `400 validation failed` rather than accepted
and quietly discarded later. `new Date().toISOString()`, Python's
`datetime.now(timezone.utc).isoformat()`, and `date -u +%Y-%m-%dT%H:%M:%SZ` all
produce the right thing.

### Counting down to a deadline

Set `deadline` and the card draws a relative countdown that **the device ticks
on its own**:

```json
{
  "id": "cert-expiry",
  "template": "summary",
  "title": "TLS certificate",
  "value": "api.example.com",
  "status": "warning",
  "icon": "lock.shield",
  "deadline": "2026-09-02T00:00:00Z"
}
```

This is the one relative time a card can hold and keep right. A widget reloads
at most once every 30 minutes, so "expires in 3 days" published as a *string*
is stale within the hour and wrong for most of its life on screen. `deadline`
costs no reloads at all — iOS re-renders the text locally, the same way a Live
Activity's `endsAt` works.

Use it for anything with a due time: a certificate expiry, the next scheduled
run, when a boost ends, when a deploy window closes. It sits alongside any
template, and it replaces the "updated N ago" stamp at the bottom of the card
rather than crowding in next to it. A deadline in the past keeps counting, so
overdue reads as overdue.

`deadline` says when something is due; `staleAfter` says when to stop trusting
what the card shows. They are unrelated and a card may set either, both, or
neither.

`staleAfter` is a rendering hint. iOS keeps showing the card, but renders it in a stale/secondary state so the operator can tell the value is old; it does not hide or delete the card.

### Asking the operator to step in

An agent that has run out of things it can decide on its own needs to say so,
and "Needs you" is the one label every surface uses for that hand-off. There is
no `needsYou` field to send. It is **derived**, and you earn it by publishing
both halves of the claim:

- an attention `status` — `warning`, `critical`, `offline`, `paused`, or
  `unknown`, and
- at least one entry in `actions`.

```json
{
  "id": "release-launch",
  "template": "summary",
  "title": "Launch",
  "value": "4/5",
  "status": "warning",
  "actions": [{ "id": "approve-launch", "label": "Approve" }]
}
```

Send both and the card is badged **Needs you** in place of its ordinary status
pill. Send the status alone and it keeps a plain status badge, which is the
honest result: a `warning` nobody can act on from the card is an observation,
not a hand-off, and promising a decision the operator has no button for is worse
than staying quiet. Send the action alone and it is a healthy card with a
button. So the field to reach for is `actions` — see [Actions](#actions) for the
button shape and the destructive-action rules.

A **Live Activity** earns the same badge by a different route: any row in
`items` with `"status": "warning"` that has not reached `finished` or `offline`
marks the whole activity as waiting on its operator. Only `warning` does this —
`critical` and `offline` rows usually mean the machinery is degraded rather than
that a person has a decision to make.

### Ordering

Cards come back **highest `priority` first**, and cards with the same priority
are ordered by `id`. `priority` is a signed integer; leave it off and the card
counts as `0`.

```json
{ "id": "api-status", "template": "summary", "title": "API", "priority": 10 }
```

That order is what the app's dashboard shows, what `GET /v1/cards` and
`GET /v1/dashboard` return, and which cards fill a Home Screen grid widget the
operator has not configured with specific ones. Set `priority` on the one or
two cards that matter and leave the rest alone.

Without it the `id` is the sort key, which is a bad job for it to have: `id` is
the dedupe key, so the only way to promote a card would be to rename it — and
renaming it creates a second card. Use `priority` to say what matters and keep
ids stable.

### Two producers on one id

An upsert is **last-write-wins, unconditionally**. There is no compare-and-set,
no version, and no way to say "only if it hasn't changed since I read it": the
card you send replaces the stored one whole, and if two producers publish the
same `id` the later request is what remains. Neither is told the other exists.

That is fine when one producer owns a card, which is the shape this API is
built for. It is a bug when two share one, and the fix is on your side, not in
a flag here — namespace the ids so each producer owns its own (`myapp-build`,
`ci-build`), which the stable-id advice below already recommends for a
different reason.

It also means a partial update is not a thing. Send the whole card every time;
omitting a field removes it rather than leaving it alone. (A Live Activity
`update` is the opposite — it merges, and clearing takes an explicit `null`.
The two differ because a card is a complete snapshot and an activity is a
running thing being nudged.)

### Stable ids

The `id` field is the dedupe key, and it is also a URL path segment
(`/v1/cards/<id>`), so it may contain only letters, digits, and `.` `_` `:` `-`.
Anything else is a `400`. Pick a slug that's stable across runs of your code:

- `solar-home`, `washer-cycle`, `car-charge`, `school-balance-<child>`, `build-status-<repo>`
- **Don't** put timestamps or run ids in there — every publish would create a new card.
- **Do** namespace if you might collide with another integration: `myapp-build-status` rather than `build-status`.
- **Don't** start an id with `sample-`. That prefix is reserved for the demo cards the iOS app can generate locally; the app badges those cards as samples and offers to delete them.

## Live Activities

Use a Live Activity instead of a card when:

- The thing has a **defined start and end** (a charge cycle, a build, a delivery, a meeting, a job).
- The user benefits from seeing it on the Lock Screen / Dynamic Island while it's happening.
- It will end on its own within ~hours.

A job you are about to spend minutes on and report progress for meets all three
by construction, and that is the case most often published as a card by mistake.

Otherwise — standing state with no end, something the operator checks rather
than watches — use a card. Cards are cheaper and don't compete for screen real
estate, but "cheaper" is about the reload budget, not about which is safer to
reach for.

### Start

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/live-activities/start" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "externalActivityId": "ci-build-2026-04-26-1234",
    "kind": "job",
    "title": "CI build #1234",
    "subtitle": "running tests",
    "state": "running",
    "signal": "neutral",
    "icon": "hammer",
    "progress": 0.2,
    "endsAt": "2026-04-26T18:45:00Z",
    "countdownGranularity": "minute",
    "staleAt": "2026-04-26T19:00:00Z",
    "alert": {
      "title": "CI build started",
      "body": "Running tests"
    }
  }'
```

The Worker sends an ActivityKit push-to-start notification to every registered device. iOS returns a per-activity APNs push token, which the app registers with the backend for subsequent updates and end events. `alert` is optional in this public request; when omitted, the Worker creates the required APNs alert from `title` and `subtitle`. The pending endpoint remains temporarily available as a compatibility fallback for older app builds.

The response:

```json
{
  "ok": true,
  "activityInstanceId": "lai_9f3c1d7a2b",
  "restarted": false,
  "pending": true,
  "pushToStartAttempted": 1,
  "pushToStartRecentlyActive": 1,
  "pushToStartPrunedStale": 0,
  "apnsResults": [{ "status": 200, "apnsId": "…" }]
}
```

**Check `pushToStartAttempted` on your first start.** It counts the devices that
were sent the push, and `0` means no device has ever registered a push-to-start
token — the operator has not installed the app, or has not allowed
notifications. Nothing you publish will be seen, and no later call will tell you
so any more clearly. Say that to the operator instead of continuing to publish
into nothing.

`pushToStartRecentlyActive` is how many of those devices have run the 00Widget
app in the last 7 days. APNs accepts a start for a device that will never show
it — an old install, a phone in a drawer — so `status: 200` alone cannot tell
you, and fewer recently active devices than attempted is the hint.
`pushToStartPrunedStale` counts devices that had not run the app in 30 days:
they were not sent this start and are no longer counted, until the app next
launches on them.

`restarted` is `true` when an activity was already running under this id, so
this call replaced it. `apnsResults` carries one entry per device;
`status: 200` is delivered.

#### Starting an id that is already running restarts it

`start` on an `externalActivityId` with a live activity behind it is a restart,
not an error and not an update. 00Widget ends the running activity and replaces
it with a new one, and the response says so:

```json
{ "ok": true, "activityInstanceId": "…", "restarted": true, "pending": true,
  "pushToStartAttempted": 1, "apnsResults": [ … ] }
```

This is the only way to change `title`, `kind` or `deepLink`, which are frozen
for the life of an activity. It costs the user a visible transition — the old
banner dismisses, the new one animates in — so it belongs to a deliberate
change of subject, never to a routine update. Everything that merely *moves*
goes through `/v1/live-activities/update` instead.

The restart is complete: a new `activityInstanceId`, a new `startedAt`, and no
content state carried over from the old one. Send the full state you want, the
way you would for any other start.

`state` is free-form text for your domain. The current iOS renderer displays it as text and does not reserve special rendering behavior for values like `paused` or `finished`; use `progress`, `value`, `unit`, `endsAt`, `icon`, and `kind` for visual structure.

Live Activity rendering fields:

- `kind`: one of `generic`, `progress`, `charging`, `appliance`, `job`, `timer`. If no icon is set, these render as `square.dashed`, `chart.bar`, `bolt.car`, `washer`, `hammer`, and `timer`.
- `icon`: optional SF Symbol name, such as `flame.fill`; overrides the kind icon. Same semantics as card icons.
- `statusIcon`: optional second SF Symbol for what the activity is *doing* right now, drawn beside the main one — `bolt.fill` while boosting, `exclamationmark.triangle.fill` when something needs attention, `pause.fill` while held. Where `icon` says what the activity is, this says what it is doing, so it is content state and may change on every update; send `null` to remove it. The same field exists on each item. Omitted from the compact and minimal Dynamic Island, which have no room for a second glyph.
- `signal`: optional `favorable`, `neutral`, `caution`, or `unfavorable` meaning for the current state. The clients choose the color and fallback symbol; producers never send presentation colors. It is content state, so an update may change it as conditions change, and `null` returns to the ordinary `kind` accent. Use it for meaning such as charging cheaply, approaching a limit, or a failed run; keep the free-form detail in `state` and `subtitle`.
- `progress`: optional `0.0`–`1.0` progress bar. It is also what fills the Dynamic Island's minimal ring — see ["When a second Live Activity is running"](#when-a-second-live-activity-is-running).
- `items`: optional composite snapshot. Each item accepts `id`, `title`, `subtitle`, `icon`, `statusIcon`, `value`, `unit`, `progress`, `status`, and optional `semantic: {role?, flow?}` with the same item rules as cards. Nonempty items render as per-item rows on the Lock Screen, the expanded Dynamic Island, the app's Activities tab, and the Apple TV dashboard, in place of the top-level progress bar, and the activity summarises itself with an active-item count — `2 active`, or just `2` in compact mode. Send a top-level `value` (plus optional `unit`) to say what the headline number should be instead: an explicit value always outranks the derived count. Items with `status: "finished"` or `"offline"` are hidden. Omit inactive items from later snapshots when possible. **Items suppress a `chart` on the Lock Screen and Dynamic Island** — see ["`items` and `chart` compete for the same space"](#items-and-chart-compete-for-the-same-space).
- `chart`: optional **DashboardChart**, exactly as on a `chart` card — `points`, `min`, `max`, `reference`, `style`. This is where a chart earns the most: a Live Activity exists because a number is moving, and the plot says which way while a progress bar only says how far. Queue length dropping, watts climbing, download rate holding. It is content state, so every update may carry a new window; send the whole window each time. When both `chart` and `progress` are sent, the chart wins the space. When `items` are also sent, the chart loses it — see ["`items` and `chart` compete for the same space"](#items-and-chart-compete-for-the-same-space) before sending both.
- `endsAt`: optional ISO-8601 end time. When present, iOS renders a countdown driven by the device clock; you do not need periodic updates just to tick time forward.
- `countdownGranularity`: optional `second` or `minute`, and ignored when there is no `endsAt`. The default is `second`, which preserves the native ticking countdown. Use `minute` for approximate estimates: iOS renders rounded-up text such as `~12 min` or `~1h 12m` and updates it locally at minute boundaries without APNs pushes. Omitting this field from a partial update preserves the activity's current granularity.
- `relevanceScore`: optional non-negative number. Smart Stack on iPhone Lock Screen and Apple Watch ranks Live Activities by it (higher wins, no fixed ceiling). Send a low score early in a long-running activity and ramp it up as the activity gets more urgent or interesting; spike it on the finishing update so the wrist surfaces it. Accepted on both `start` and `update`.

For a time-bounded operation, prefer `endsAt` over server-ticked percentage updates. A "boosting until 21:30" activity can be `start` with `endsAt`, then `end` when finished or cancelled.

#### When a second Live Activity is running

As soon as a second Live Activity starts — anyone's, including the system's own
Screen Recording — iOS collapses every activity in the Dynamic Island to its
*minimal* presentation: one circle roughly 24pt across, in place of both compact
regions. No app can decline this or influence which activities are shown, so
whatever your compact presentation was saying disappears for as long as the
other activity runs.

00Widget fills that circle with the most informative thing your state carries,
in this order:

1. `endsAt` — the countdown in a single unit: `45s`, `12m`, `3h`, `2d`. Ticks
   locally, no pushes needed.
2. `progress` — a ring around the icon. Failing an explicit `progress`, a ring
   is derived from `items` (how many have finished, or the mean of their own
   `progress` when they all carry one), and failing that from a whole-number
   counter written into `value` — `1/4`, `Capture 1/4`, `3 of 8`.
3. `items` with no top-level `value` — the active-item count.
4. `value`, when it is three characters or fewer — `1/4`, `78%`, `20°`.
5. Otherwise the icon alone, which is what every activity used to show here.

The practical advice: **send `progress` whenever your activity has one**, even
alongside `value` or a `chart`. It costs nothing on the surfaces that have room
for the real thing, and it is the difference between a ring that says how far
along you are and a static icon that says nothing. If your headline number is
short, keep `value` short too and put the prose in `subtitle` — `value: "1/4"`
with `subtitle: "Capturing screenshots"` reads in the minimal circle, where
`value: "Capture 1/4"` does not.

#### How much room each surface actually has

The size limits above are **transport** limits: 120 characters of `title` will
be stored, pushed, and reported back to you intact. They are not design
budgets, and reading them as budgets is the commonest way to publish an
activity that is valid, succeeds, and renders badly. Roughly a third of a
Dynamic Island is what draws that title.

What each surface has room for, in characters:

| Surface | `title` | `value` | `subtitle` |
| --- | ---: | ---: | --- |
| Dynamic Island, minimal circle | — | 3 | — |
| Dynamic Island, compact | — | ~7 | — |
| Dynamic Island, expanded | ~24 | ~10 | ~80, over two lines |
| Lock Screen | ~30 | ~10 | ~80, over two lines |
| Apple Watch (Smart Stack) | ~20 | ~8 | — |
| 00Widget app, Apple TV | full | full | full |

Three things follow that are not obvious from the table:

- **The compact and minimal Dynamic Island regions never draw `subtitle` at
  all**, and the minimal circle does not draw `title` either. Anything that
  must survive being reduced to a 24pt circle has to be in `value`, `progress`,
  `items` or `endsAt`.
- **Over-budget text shrinks before it truncates**, so the failure looks like a
  smaller font rather than an error, and then like a word cut off mid-way. No
  API response tells you it happened; you are not holding the phone.
- **`title` is the one you cannot fix later.** It is an ActivityAttribute
  (below), so an over-long title is frozen for the life of the activity.

`start` and `update` return a `warnings` array on success when they can see one
of these coming — an over-long title, prose in `subtitle`, a step counter in
`value` with no `progress`, a deadline already passed, a `chart` that `items`
will hide, or a missing `staleAt`. It is advisory, never an error, and empty
when there is nothing to say. Read it: it is the only view you get of a screen
you cannot see.

#### A job with named parts is `items`

Every other example here is one moving number. The commonest shape an agent
actually has is different: a job made of several named parts, each with its own
state — four device sets to capture, six services to deploy, three files to
upload. That is what `items` is for, and it is worth reaching for even when the
job also has a headline number.

Sending it as prose in `subtitle` is the alternative, and it is worse on every
surface: the compact and minimal Dynamic Island regions never draw `subtitle`,
the expanded island gives it two lines, and no part can carry its own status.

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/live-activities/start" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "externalActivityId": "screenshots-2026-09-02",
    "kind": "job",
    "title": "Screenshots",
    "state": "running",
    "value": "1/4",
    "progress": 0.25,
    "endsAt": "2026-09-02T11:32:00Z",
    "countdownGranularity": "minute",
    "staleAt": "2026-09-02T11:00:00Z",
    "items": [
      {"id": "iphone-63", "title": "iPhone 6.3\"", "value": "6m 30s", "progress": 0.6, "status": "running"},
      {"id": "iphone-65", "title": "iPhone 6.5\"", "status": "pending"},
      {"id": "ipad",      "title": "iPad",        "status": "pending"},
      {"id": "tvos",      "title": "Apple TV",    "status": "pending"}
    ]
  }'
```

What that buys, none of which needs another field:

- **Per-part state on the Lock Screen and in the expanded island.** Up to three
  rows are drawn, with a `+N more` line beneath them; each row can carry its own
  `value`, `unit`, `progress`, `icon` and `status`.
- **A count for free.** With `items` and no top-level `value`, the surfaces that
  have room draw "3 active" and the compact island draws `3`. Send `value` when
  you have a better headline — as above — and it wins.
- **A ring in the minimal circle.** Failing an explicit `progress`, one is
  derived from how many items have finished, or from the mean of their own
  `progress` when they all carry one.

Then update the rows as parts complete. Items are snapshot semantics, so send
the whole array each time; a part that is done gets `status: "finished"`, which
both greys it out and feeds the derived count.

Keep the parts to six or fewer — that is the hard limit — and keep each `title`
short, because a row is one line. If a job has twenty parts, the items are the
*stages*, not the units of work.

#### `title` is frozen when the activity starts

iOS splits a Live Activity into *static attributes*, fixed for the whole life of
the activity, and *dynamic content state*, which is the only thing an update can
carry. Apple's wording: "The `ActivityAttributes` inform the system about static
data that appears in the Live Activity", and `Activity.update(_:)` "updates the
**dynamic** content of a Live Activity". There is no API — in-app or via APNs —
that replaces the attributes of a running activity.

In 00Widget, three of the start fields are attributes and **cannot be changed
after `start`**:

- `title`
- `kind`
- `deepLink`

Everything else is content state and updates normally: `subtitle`, `state`,
`signal`, `icon`, `statusIcon`, `value`, `unit`, `progress`, `items`, `chart`, `endsAt`,
`countdownGranularity`, `staleAt`, `relevanceScore`.

So `title` must be the stable *name of the thing*, never a value that moves.
`"CI build #1234"`, `"Dishwasher"`, `"Deploy to prod"` are good titles;
`"3/12 tests failed"`, `"42 min left"`, `"64% charged"` are not — they will
still say `3/12` an hour later, on the Lock Screen, while every other field on
the same activity is current. Put counters in `value` + `unit`, progress in
`progress`, prose in `subtitle`, per-row detail in `items`, and remaining time
in `endsAt`.

If a title genuinely has to change — the activity is now about a different
thing, not a different value — `start` again with the **same**
`externalActivityId`. That restarts it: 00Widget ends the running activity and
puts a fresh one in its place with the new attributes. It is a visible restart
to the user (the old activity dismisses, the new one animates in), so don't do
it per tick.

#### `items` and `chart` compete for the same space

**Sending both `items` and `chart` silently hides the chart on the Lock Screen
and in the Dynamic Island.** There is no error and no warning — the start or
update returns `200`, `GET /v1/live-activities` reports the chart back to you,
and the 00Widget app's Activities tab draws it. Only the surfaces the activity
exists for drop it, which is why this is normally discovered on a device, late.

The rule iOS forces, surface by surface:

| Surface | With `items` | Without `items` |
| --- | --- | --- |
| Lock Screen banner | item rows, **no chart** | chart (and it outranks `progress`) |
| Dynamic Island, expanded | item rows, **no chart** | chart, else `progress` |
| Apple Watch (Smart Stack) | item rows | **never a chart** |
| 00Widget app, Activities | item rows **and** chart | chart |
| Apple TV dashboard | item rows **and** chart | chart |

Item rows already fill the banner and iOS gives you no room for both. The Watch
family is smaller still and never draws a chart at all, with or without items.

Two consequences worth planning around:

- **It is the *active* items that count**, not the array. Items with
  `status: "finished"` or `"offline"` are hidden, so an activity whose items
  have all finished falls back to the no-items layout and the chart *reappears*
  mid-run. A producer that sends both gets a banner that changes shape when the
  last item completes.
- **`items` is snapshot semantics**, so an update carrying `"items": []` returns
  the activity to the chart layout, and an update that omits `items` keeps
  whatever rows are already there — including their suppression of the chart.

So pick one per activity, and pick it from what the activity *is*:

- Several things each with their own state — three chargers, a queue of jobs, a
  set of checks — is `items`. A chart of one of those numbers is a second story
  the banner has no room to tell.
- One number moving over time — watts, queue depth, download rate — is `chart`,
  with `value` + `unit` for the headline. Don't decompose it into one item per
  reading.

If you genuinely need both views, they are two activities with two
`externalActivityId`s, and the user sees two banners — usually the wrong trade.

### Update

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/live-activities/update" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "externalActivityId": "ci-build-2026-04-26-1234",
    "state": "running",
    "subtitle": "linting",
    "progress": 0.6,
    "endsAt": "2026-04-26T18:45:00Z",
    "countdownGranularity": "minute",
    "relevanceScore": 60
  }'
```

Add an `alert: { title, body }` for state changes worth notifying the user about (finished, failed). Use sparingly. The `alert` title is the banner text for that one notification; it does not rename the activity.

The response:

```json
{
  "ok": true,
  "activityInstanceId": "lai_9f3c1d7a2b",
  "apnsResult": { "status": 200, "apnsId": "…" },
  "recipientResults": [],
  "pendingUpdated": false,
  "registeredDevices": 1,
  "secondsSincePreviousUpdate": 47,
  "staleAtPushed": "2026-04-26T19:00:00Z",
  "warnings": []
}
```

`secondsSincePreviousUpdate` is how long the activity spent showing its previous
state. Going quiet has no error — the calls you make answer `200` and the ones
you skip return nothing — so this is the only signal you get. If it is much
larger than the work between updates should take, the operator has been reading
a stale Lock Screen as current.

`staleAtPushed` is the stale date **this push carried**, which is not always the
one stored. The row keeps whatever `staleAt` it was last given, while the APNs
payload sets `stale-date` only from the `staleAt` in *this* request — so an
update that omits it stores a stale date and sends none. `null` means this push
set none: nothing marks the activity out of date if you stop here.

`pendingUpdated: true` means the new content state was stored but pushed
nowhere: no device holds a token for this activity yet. Right after a `start`
that is normal and resolves within seconds, as the device registers the token
iOS hands it. Still true minutes later, it means the activity never appeared —
check `pushToStartAttempted` from the start. Nothing needs re-sending either
way: a device that registers late is sent the activity's current state at that
moment. `registeredDevices` is how many of the operator's devices hold a token
for this activity; set it against `pushToStartAttempted` to see how many were
sent the start and have not registered it. `recipientResults` is non-empty
only when the activity has been shared with another account.

An update accepts a `title`, and it does change what `GET /v1/live-activities`
reports, but **it does not change the running Live Activity** on the Lock
Screen, in the Dynamic Island, or on a paired Watch — see
["`title` is frozen when the activity starts"](#title-is-frozen-when-the-activity-starts)
above. Treat `/v1/live-activities/update` as content-state-only and leave
`title` out of it.

#### Omitting keeps, `null` clears

An update is a partial: a field you leave out keeps whatever the activity
already has. To *remove* one, send it as `null`.

```json
{
  "externalActivityId": "ci-build-2026-04-26-1234",
  "state": "passed",
  "signal": "favorable",
  "progress": null,
  "endsAt": null,
  "chart": null
}
```

That is the update a job that finished early has to send. Without it the
countdown keeps running against a time that has passed, the progress bar stays
frozen at 0.6, and the chart keeps taking the Lock Screen space that `progress`
would otherwise have.

Clearable this way: `subtitle`, `signal`, `icon`, `statusIcon`, `value`, `unit`,
`progress`, `items`, `chart`, `endsAt`, `countdownGranularity`, `staleAt`,
`relevanceScore`.
Clearing `endsAt` drops `countdownGranularity` with it, since it means nothing
without a date to count down to. `state` cannot be cleared — every activity has
one — and `title` cannot be changed at all.

`items` uses snapshot semantics. Omitting it from an update preserves the current
items, sending a new array replaces the complete list, and sending `"items": []`
or `"items": null` returns the activity to its top-level fallback fields.
Producers should send one coalesced snapshot rather than updating individual
items independently.

#### Keeping one honest

The Lock Screen shows the last state you sent.

- **Update at every meaningful step of the work it describes.** An activity
  that stops moving while the work continues is worse than one you never
  started, because the operator reads it as current. If your run has natural
  units — a commit, a test suite, a file — send one update per unit rather than
  batching several and going quiet in between.
- **Send `staleAt` on every push**, a little past when you next expect to
  publish. It is the only thing that makes a stalled producer visible: past it,
  iOS renders the activity as out of date rather than as fact. It costs nothing
  when you do keep publishing, and it is what turns a silent failure into a
  visible one.
- **Always end it**, even when the run failed or was abandoned.

Missed updates generate no API error. Set `staleAt` so iOS can show when the
last state is out of date.

#### Long-lived activities

If the activity still needs to run, call `start` with the same
`externalActivityId` and the current state at **7 hours 45 minutes from
`startedAt`**. Start earlier if your schedule or push delivery needs more time.
00Widget requests immediate dismissal of the old activity before starting the
replacement. If iOS ends it at eight hours first, the old banner can stay on
the Lock Screen for up to four more hours.

### List

To inspect the tenant's currently ongoing activities, call
`GET /v1/live-activities`.

```sh
curl "$00WIDGET_BASE_URL/v1/live-activities" \
  -H "Authorization: Bearer $00WIDGET_API_KEY"
```

The default response is a JSON object with an `activities` key holding an
array — never a bare array. An empty result is
`{"activities":[]}` with status 200, so there is no shape to fall back to and
no need for defensive parsing:

```json
{
  "activities": [
    {
      "activityInstanceId": "lai_9f3c1d7a2b",
      "externalActivityId": "ci-build-2026-04-26-1234",
      "kind": "progress",
      "title": "Deploying api-gateway",
      "subtitle": "running tests",
      "state": "running",
      "progress": 0.62,
      "startedAt": "2026-04-26T10:00:00Z",
      "updatedAt": "2026-04-26T10:02:30Z"
    }
  ]
}
```

The default list includes activities shared with this account. Clients that
will update or end an activity should request `?ownedOnly=true` to list only
activities owned by the authenticated tenant. That response also includes
`"ownedOnly": true`; require the marker before managing an activity, because
older servers ignore the filter and external ids can collide across owners.

Add `?include=ended` for a bounded window of activities that have finished:

```sh
curl "$00WIDGET_BASE_URL/v1/live-activities?include=ended" \
  -H "Authorization: Bearer $00WIDGET_API_KEY"
```

```json
{
  "activities": [ ... ],
  "ended": [
    {
      "activityInstanceId": "lai_9f3c1d7a2b",
      "externalActivityId": "ci-build-2026-04-26-1234",
      "kind": "job",
      "title": "CI build #1234",
      "finalState": "finished",
      "finalSubtitle": "passed in 4m 12s",
      "startedAt": "2026-04-26T10:00:00Z",
      "endedAt": "2026-04-26T10:12:40Z"
    }
  ]
}
```

That is how to check whether an end actually landed, and how to find a run
whose `externalActivityId` you lost rather than starting a duplicate. It keeps
**24 hours** and no more — a Live Activity's own ceiling is 8 hours plus a
4-hour dismissal window, so a day covers everything that could still be recent.
It is a reconciliation window, not a log; nothing older is kept and there is no
way to ask for more.

Each entry uses the same session fields as the start/update payloads, plus a
server-issued `activityInstanceId`. Optional fields are omitted rather than sent
as `null`. Producers continue addressing their own activity by
`externalActivityId`; the opaque instance ID binds device registrations and
shared deliveries to one exact owner activity. This allows a recipient to
receive same-named activities from multiple owners without update or cleanup
collisions. Ended activities are omitted.

### End

```sh
curl -X POST "$00WIDGET_BASE_URL/v1/live-activities/end" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "externalActivityId": "ci-build-2026-04-26-1234",
    "finalSubtitle": "passed in 4m 12s",
    "finalState": "finished",
    "finalSignal": "favorable",
    "finalValue": "12/12",
    "finalProgress": 1,
    "finalEndsAt": null
  }'
```

Always end. Stale activities clutter the Lock Screen until iOS gives up on them.

The final frame is content state too, and it **starts from the activity's last
state**: whatever the end does not name stays as it was. `finalState` and
`finalSubtitle` set the text. `finalSignal`, `finalStatusIcon`, `finalValue`,
`finalUnit`, `finalProgress`, `finalItems`, `finalChart`, and `finalEndsAt`
follow update semantics — omit one to keep the current value, send `null` to
remove it, or send a new one. There is no `finalTitle` — the title is an
attribute and cannot be rewritten, not even on the last frame. Say what happened
in `finalSubtitle`.

What to send depends on how the run ended, which only you know:

- **Completed** — `finalProgress: 1` and a final `finalValue` such as `"12/12"`;
  an activity ended at `2/3` otherwise says `2/3` on its last frame.
- **Cancelled or failed part-way** — omit `finalProgress`, so the bar still
  shows how far it got.
- **Had a countdown** — `finalEndsAt: null`. Kept, the Lock Screen timer counts
  *up* past zero for as long as the frame stays on screen. It does not affect
  dismissal; `dismissalDate` does.
- **Had a chart** — usually omit `finalChart`. The history is still true once
  the work is done, and the final curve is often the most useful thing on the
  frame.

A final frame is held to the same 4 KB ActivityKit limit as start and update,
and one over it is rejected with `400` and the activity kept, because APNs
would accept it and the device would silently drop it.

When `dismissalDate` is omitted, 00Widget dismisses the ended Live Activity immediately. To keep the final state visible briefly, set `dismissalDate` to an ISO-8601 time within Apple's four-hour dismissal window. The free-form `state` field does not end an activity by itself, even when its value is `finished`.

The response is `{ "ok": true, "apnsResult": {...}, "recipientResults": [] }`,
with the same shape of APNs result as an update.

An end is acknowledged with `200` only after APNs accepts the end event (or reports that the device token is permanently gone). If APNs delivery fails, 00Widget returns `502` and retains the activity record. Retry the same end request; do not discard your `externalActivityId` until a `2xx` response is received.

## Actions

Define buttons as `actions`. Any template can carry them; `template: action` is
simply the one for a card whose main purpose is its buttons.

```json
{
  "id": "boiler",
  "template": "action",
  "title": "Boiler",
  "subtitle": "Manual override",
  "value": "Ready",
  "status": "good",
  "icon": "flame",
  "actions": [
    { "id": "boiler-boost-1h", "label": "Boost 1h" }
  ]
}
```

Before buttons can call your system, register the account's default webhook.
This needs the `webhook:manage` scope, which the API publisher token has and an
MCP-minted token does not:

```sh
curl -X PUT "$00WIDGET_BASE_URL/v1/integrations/webhook" \
  -H "Authorization: Bearer $00WIDGET_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{ "url": "https://example.com/00widget/actions" }'
```

The response includes a write-only `signingSecret`; add `"rotateSecret": true`
to a later `PUT` to receive a replacement once. The singular routes permanently
address `default`. An account may hold ten webhooks total: use the same body at
`PUT /v1/integrations/webhooks/<id>`, `GET`/`DELETE` that path to manage it, and
`GET /v1/integrations/webhooks` to list metadata. Secrets are independent.

Set an action's write-only `webhookId` to select a named destination, or omit it
for `default`. Like `payload`, it never reaches reads, shares, or devices. A
missing selection returns `409`; each action goes to one endpoint, never all.

When the user taps the button, 00Widget receives `POST /v1/actions/<actionId>/run` from the app/widget, resolves the stored card action and its destination, and forwards one signed `POST` to that webhook:

```json
{
  "deliveryId": "018f6e62-3d3c-7c5c-9f7a-...",
  "timestamp": "2026-05-01T12:34:56.789Z",
  "source": "widget",
  "accountId": "tenant_...",
  "action": {
    "id": "boiler-boost-1h",
    "label": "Boost 1h",
    "payload": { "duration": "3600" }
  },
  "context": {
    "cardId": "boiler",
    "cardTitle": "Boiler"
  }
}
```

Headers:

- `X-00Widget-Delivery`: same value as `deliveryId`, for idempotency.
- `X-00Widget-Timestamp`: Unix seconds when the delivery was signed.
- `X-00Widget-Signature`: `sha256=<hex hmac>`.

The HMAC key is the `signingSecret`. The canonical string is:

```text
<X-00Widget-Timestamp>.<raw JSON request body bytes>
```

Reject deliveries whose timestamp is more than 5 minutes from your clock, and dedupe by `deliveryId`. Treat delivery as **at least once**: 00Widget retries network errors and `5xx` responses up to 3 total attempts with short backoff. It does not retry `2xx`, `4xx`, or permanent validation failures. If all attempts fail, the app/widget action run returns `502` and the tap is considered abandoned.

Any `2xx` from your webhook is an ack. An empty body is fine. If you return JSON shaped as either a `DashboardCard` or `{ "card": DashboardCard }`, 00Widget immediately upserts that card and reloads widgets that can display cards; otherwise the response body is ignored. You can also return `2xx` and publish a separate `/v1/cards/upsert` later.

Only `role: "normal"` + `confirm: false` actions run through `/v1/actions/:id/run`. The server derives `source: "widget"`; callers cannot override it. Actions marked `confirm: true` or `role: "destructive"` are run by the iOS app after the user confirms, on a credential it holds itself — you define them the same way and receive the same webhook delivery.

## Compatibility

`/v1` is the only version there has ever been, and these are the rules it
follows. They exist so you can write an integration once and leave it running.

**Unknown request fields are ignored.** Every body is validated against a schema
that drops what it does not recognise, so sending a field this deployment
predates is not an error. You never need to feature-detect before publishing.

**Responses may gain fields.** Parse the keys you need and ignore the rest.
Every read answers with a single-key object — `{"card":…}`, `{"cards":[…]}`,
`{"activities":[…]}` — and that envelope will not change under `/v1`.

**Unknown enum values degrade rather than fail.** A `status` or a Live Activity
`kind` this deployment does not know falls back to `unknown` and `generic`. On
the device, a card whose `template` a build predates renders as a `summary`
rather than disappearing — so a new template added later shows up as a plain
card on an old app instead of taking the whole cached list down with it.

**New fields are additive and optional.** Anything added to a card or an
activity has a defined meaning when absent. `progress` and `deadline` are the
recent examples: cards published before either existed keep rendering exactly
as they did.

**A renamed scope keeps answering to its old name.** `tenant:read` became
`read`; a credential issued under the old spelling still works, and the OAuth
`scope` parameter accepts either. Only the new name is issued and reported.

**Upsert is last-write-wins and will stay that way.** No conditional write is
coming; if one is ever added it will be an optional field on the request, not a
change to what an unconditional publish does.

**Ids and dates are validated on the way in, not on the way out.** Tightening
either rule rejects new bad values without breaking anything already stored, so
a card written under an older, looser rule keeps being served.

What is *not* promised: the exact wording of an `error` string (match on the
status code and, where present, `code`), the ordering of `apnsResults`, and the
contents of any field documented as a rendering hint.

If something incompatible ever has to happen, it happens at `/v2` and `/v1`
keeps working. Nothing is deprecated by silently changing under you.

## Rate limits

00Widget enforces fixed-window rate limits per tenant and, for hot resources, per card/action/activity id. If you receive `429`, stop sending that operation and retry after the `Retry-After` header.

| Operation | Scope | Limit |
| --------- | ----- | ----: |
| Any mutating `/v1/*` write | tenant | 1000 / hour |
| Card upsert | tenant | 600 / hour |
| Card upsert | card id | 60 / hour |
| Live Activity start | tenant | 120 / hour |
| Live Activity update | tenant | 600 / hour |
| Live Activity update | activity id | 120 / hour |
| Live Activity end | tenant | 240 / hour |
| Live Activity recovery | tenant | 60 / hour |
| Live Activity recovery | device + activity | 6 / hour |
| Action run | tenant | 240 / hour |
| Action run | action id | 60 / hour |
| Device/widget/Live Activity token registration | tenant | 240 / day |
| Webhook integration changes | tenant | 20 / day |
| Share mutations | tenant | 120 / day |
| Apple app login attempt | client IP, before token verification | 60 / hour |
| Apple app login token exchange | verified Apple user | 30 / hour |

Every response that spends budget carries what is left of it, so you can pace
yourself rather than discovering the wall by hitting it:

```
RateLimit-Limit: 60
RateLimit-Remaining: 59
RateLimit-Reset: 2841
```

They describe the **tightest** limit that request touched — the one that will
bite first — and `RateLimit-Reset` is seconds until that window rolls over. A
read that consumes no budget carries no such headers rather than guessing. A
`429` carries `Retry-After` as well, and `GET /v1/status` reports every window
this account has touched.

Agents should coalesce state changes and avoid hot loops. Publish one batch per producer snapshot, skip a publish when none of the displayed values changed, and respect `429 Retry-After` instead of retrying immediately.

## How fast a widget actually updates

A publish is stored the moment it returns. Getting it *drawn* is a separate
question, and the answer is Apple's, not ours.

iOS gives each widget a daily reload budget — Apple documents "40 to 70
refreshes" for a widget someone looks at often — and **push notifications draw
on the same budget as the widget's own periodic refreshes**. There is no
mechanism, for us or anyone, to reload a widget more often than that budget
allows.

Within it, 00Widget aims to spend the budget on changes rather than on polling:

| | |
| --- | --- |
| Shortest gap between two reload pushes to one widget | **5 minutes** |
| Reloads available back-to-back after a quiet stretch | **6** |
| One more becomes available every | **30 minutes** |
| The widget's own periodic refresh, as a safety net | hourly, backing off to 4-hourly once it can see pushes arriving |

That last pair is an allowance that refills rather than a daily quota, which
matters if you publish a lot: a quota can be spent in a few hours and leave the
widget dark for the rest of the day, where a refilling allowance always hands
one back. Publish freely after a quiet period; keep publishing all day and you
settle to roughly one reload every 40 minutes rather than stopping.

Each *widget* has its own allowance, not each account: publishing a card shown
on one widget does not delay another. Publishes inside a window are not lost —
they are stored immediately and coalesced, so the next reload carries the
latest state of everything, and opening the app always shows current data.

What this means for you:

- **Publish when something changes.** You do not need to throttle; that is what
  the coalescing is for. Skipping a publish when nothing changed still helps,
  because it leaves budget for one that matters.
- **Expect up to a few minutes**, not seconds, for a Home Screen widget.
- **`GET /v1/status`** reports `secondsUntilNextWidgetReload` for the account
  in front of you, along with the numbers above.
- **If you need seconds, use a Live Activity.** It is a different mechanism with
  a different budget, which is why it exists.

## Errors

- `401 {"error":"..."}` — bad or missing bearer token. Don't retry with the same key.
- `403 {"error":"API scope '...' required"}` — the token is valid but lacks that capability. Ask the operator for the appropriate scoped credential.
- `400 {"error":"validation failed: ..."}` — body shape is wrong. Read the message and fix the JSON; don't retry blindly.
- `404 {"error":"not found"}` — endpoint, card id, action id, or webhook integration doesn't exist. Note the two deliberate exceptions under "Retrying is safe" below.
- `409 {"error":"webhook integration not configured"}` — an action's selected webhook is not configured. Omitted `webhookId` means the `default` destination.
- `402 {"error":"...","code":"subscription_required","subscription":{...}}` — the operator's account has no active subscription, on a deployment that requires one. Only publishing and action runs return this; reads keep working. Retrying will not help and neither will a different credential: tell the operator to renew in the 00Widget app, and relay the `error` string, which is written to be repeated to a person.
- `429 {"error":"rate limit exceeded", ...}` — wait for `Retry-After` seconds before retrying that operation.
- `502 {"error":"webhook delivery failed", ...}` — the configured action webhook returned `5xx`/failed after retries.
- `5xx {"error":"internal error"}` — backend issue. Retry with exponential backoff if the operation is idempotent (cards are; live-activity updates are by `externalActivityId`).

Error bodies are simple JSON with at least an `error` string; some endpoints add fields like `detail`, `status`, `attempts`, or `deliveryId`. The API never returns secrets in errors and is safe to log.

### Retrying is safe

Every write here converges on the same state when repeated, so a retry after a
timeout or a `5xx` never needs a "did it land?" read first.

- **Upsert** replaces the whole card. Sending it twice leaves exactly one card.
- **`DELETE /v1/cards/<id>`** answers `200 {"ok":true}` whether or not the card
  was there. Deleting something already gone is not an error, so it does not
  `404` the way the list above would suggest.
- **`POST /v1/live-activities/end`** answers `200` for an activity that is not
  running, for the same reason — including one you already ended.
- **`POST /v1/live-activities/update`** is addressed by `externalActivityId`,
  so a repeat re-sends the same content state rather than accumulating.

Two writes that are *not* idempotent, and where a retry does something:

- **`POST /v1/live-activities/start`** on an id that is already running ends it
  and replaces it — a restart, visible to the user. Retrying a start you are
  unsure landed will therefore restart it if it did. Read
  `GET /v1/live-activities` first if that matters.
- **`POST /v1/actions/<id>/run`** delivers to your webhook every time. That is
  the point — dedupe on `deliveryId` at your end.

## Snippets

### TypeScript / JavaScript (Node, Bun, Workers, browser)

```ts
async function upsertCard(card: Record<string, unknown>) {
  const res = await fetch(`${process.env.WIDGET_BASE_URL}/v1/cards/upsert`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.WIDGET_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(card),
  });
  if (!res.ok) throw new Error(`upsert failed: ${res.status} ${await res.text()}`);
  return res.json();
}

await upsertCard({
  id: "build-status",
  template: "summary",
  title: "Build",
  subtitle: "main is green",
  status: "good",
  icon: "checkmark.seal",
  deepLink: "https://example.com/dashboard",
});
```

### Python

```py
import os, requests

def upsert_card(card):
    r = requests.post(
        f"{os.environ['WIDGET_BASE_URL']}/v1/cards/upsert",
        headers={"Authorization": f"Bearer {os.environ['WIDGET_API_KEY']}"},
        json=card,
        timeout=10,
    )
    r.raise_for_status()
    return r.json()
```

### Go

```go
func UpsertCard(card map[string]any) error {
    body, _ := json.Marshal(card)
    req, _ := http.NewRequest("POST", baseURL+"/v1/cards/upsert", bytes.NewReader(body))
    req.Header.Set("Authorization", "Bearer "+apiKey)
    req.Header.Set("Content-Type", "application/json")
    resp, err := http.DefaultClient.Do(req)
    if err != nil { return err }
    defer resp.Body.Close()
    if resp.StatusCode >= 300 { return fmt.Errorf("upsert: %d", resp.StatusCode) }
    return nil
}
```

### Swift (host app, not the 00Widget app)

```swift
struct WidgetClient {
    let baseURL: URL
    let apiKey: String

    func upsert(_ card: [String: Any]) async throws {
        var req = URLRequest(url: baseURL.appendingPathComponent("/v1/cards/upsert"))
        req.httpMethod = "POST"
        req.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.httpBody = try JSONSerialization.data(withJSONObject: card)
        let (_, resp) = try await URLSession.shared.data(for: req)
        guard (resp as? HTTPURLResponse)?.statusCode == 200 else {
            throw URLError(.badServerResponse)
        }
    }
}
```

## Don'ts

- **Don't** ship UI HTML, layouts, or markdown that you expect 00Widget to render. The server only stores typed state. Pick a template.
- **Don't** create a new card id per publish. Re-use the same `id` to update.
- **Don't** name cards to control their order — `a-solar`, `b-washer`. Ids are the dedupe key; set `priority` instead.
- **Don't** write your own name into `title` or `subtitle` to get attribution. Send `producer`, which the surfaces with room for it draw on their own line and the smaller ones drop.
- **Don't** pick a `comparison.signal` from the sign of the change. `+18` errors is `unfavorable`; the signal is what the change means, not which way it points.
- **Don't** publish an attention `status` with no `actions` and expect "Needs you". The badge is derived from both, and a warning nobody can act on stays an ordinary status.
- **Don't** leave a finished activity's `progress`, `endsAt`, or `chart` in place on the last update. Omitting a field keeps it; send `null` to clear it. When ending, say it on the end itself — `finalProgress`, `finalValue`, `finalEndsAt: null` — rather than spending an update push first.
- **Don't** send `items` and `chart` on the same Live Activity expecting to see both. Items win the Lock Screen and Dynamic Island and the chart is dropped there without an error — [the rule, surface by surface](#items-and-chart-compete-for-the-same-space).
- **Don't** send a `chart` series longer than 60 points or expect the server to keep a history. Send the current window, oldest first, on every publish.
- **Don't** put secrets, API tokens, or PII in `value`/`subtitle`/`title`. Cards are visible on the Lock Screen.
- **Don't** start a Live Activity without ending it. Always send `/v1/live-activities/end` when the work is done.
- **Don't** put a counter, a countdown, or any other moving value in a Live Activity `title`. iOS freezes the title (along with `kind` and `deepLink`) when the activity starts, and no update can change it. Use `value`, `progress`, `subtitle`, `items`, or `endsAt`.
- **Don't** make destructive actions auto-run from widgets. Set `confirm: true` or `role: destructive` and let the iOS app handle confirmation.
- **Don't** loop over `/v1/cards/upsert` for cards from the same producer snapshot. Use `/v1/cards/upsert-batch` so the snapshot creates one coalesced reload decision.
- **Don't** publish anything to a card or Live Activity you would not show a stranger. A person can share either of them as a read-only link, and the holder of that link needs no account.
- **Don't** treat a Home Screen widget as a real-time display. WidgetKit budgets reloads; publish current state whenever it changes, and let 00Widget coalesce reload pushes. Use a Live Activity for frequent, time-sensitive updates.

## Notes for Cloudflare Workers callers

The 00Widget backend runs on Cloudflare Workers. If the project you're integrating from is *also* a Cloudflare Worker (or a Pages Function), two things change:

### Prefer a Service Binding when same-account

If the integrating Worker and the 00Widget Worker live in the same Cloudflare account, set up a [Service Binding](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/) rather than calling the public URL. It's faster (no DNS, no TLS), uses the internal Cloudflare network, and skips egress.

In `wrangler.toml` of the *caller*:

```toml
[[services]]
binding = "ZEROZEROWIDGET"
service = "zerozerowidget-server"
```

Then in code:

```ts
const res = await env.ZEROZEROWIDGET.fetch(
  new Request("https://zerozerowidget/v1/cards/upsert-batch", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${env.WIDGET_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ cards }),
  }),
);
```

The hostname in the URL is irrelevant — Service Bindings route by binding name. Auth headers and JSON bodies are unchanged.

### Sub-request budget

Every Worker invocation has a sub-request quota (50 on free, 1000 on paid). Each `fetch` or Service Binding call to 00Widget consumes one. A batch of related cards consumes one caller subrequest instead of one per card; **don't** publish on a hot loop.

### CPU time

Network awaiting (waiting for 00Widget's response) doesn't count against your Worker's CPU limit, but JSON serialization of a giant `DashboardCard` does. The card schema is small enough that this is never a concern in practice — flagged here only so you don't worry about it.

### Non-Cloudflare callers

If you're integrating from Vercel, Lambda, a Cloudflare Pages static site (no functions), a shell script, or anything else, none of the above applies. Just `fetch` the public URL.

## Where to look for more

- The endpoints an integration calls are listed in [`server/README.md`](../server/README.md), which also says which routes it deliberately leaves out and why.
- The data model in TypeScript (zod) lives at [`server/src/types.ts`](../server/src/types.ts).
- The same model in Swift (for reference) lives at [`ios/Sources/Shared/Models/`](../ios/Sources/Shared/Models/).
- The static-attributes / dynamic-content-state split that freezes a Live Activity's `title` is Apple's, described in [`ActivityAttributes`](https://developer.apple.com/documentation/activitykit/activityattributes) and [Displaying live data with Live Activities](https://developer.apple.com/documentation/activitykit/displaying-live-data-with-live-activities).

If you're integrating from a project that doesn't have an obvious place to call from, prefer the smallest possible code path: one function that builds the card JSON and POSTs one card or one batch. Resist the urge to wrap this in a class hierarchy.
