Yroun Guide

Hub Page Widgets

Hub pages support six live-data widget blocks that fetch from any HTTP API and render the results inline. Widgets are added through the page editor, no code deployment. A widget fetches straight from the reader's browser, or through Yroun's server-side Connection proxy when the API needs a credential that must never reach a browser.

Building widgets programmatically via REST? See Open API → Content & Widgets for the Tiptap node JSON shape and Open API → Recipes for copy-paste curl flows.

Widget types

  • API Table: fetches a JSON array and renders a filterable, paginated table. Supports optional inline create/edit plus checkbox row selection with bulk delete (staged, committed on Save).
  • API Chart: fetches a JSON array and renders a line, bar, or pie chart. Supports dynamic filter controls.
  • API Request: a Postman-style request builder. Set method, headers, and body (form or JSON). Send requests and view the response inline without leaving the page.
  • API Queue: fetches a list endpoint and groups rows by a status field into an auto-refreshing work queue (kanban-style). Built for operator dashboards: moderation, review queues, job pipelines. Supports the shared hub Endpoint/Connection picker for its URL, like the other API widgets.
  • FAQ: an accordion of questions and answers. Items live inline in the page (edited directly in the widget's settings) or come from an API via the shared Endpoint/Connection picker with a configurable field mapping.
  • Stat Grid: a row of numeric tiles (KPI or monitoring). Each tile shows one value with an optional change badge and threshold status. Values are typed in directly or read from an API, either as a list of metrics (one tile per row, so adding a metric on your server needs no page edit) or as named paths into a single response object. Whether a rise is good news is a property of each metric, so a falling bounce rate shows green while a falling session duration shows red.
  • Bookmark cards

    Paste a bare URL on an empty line and a small menu offers Link / Bookmark / Embed. Bookmark turns it into a Notion-style preview card with the site's title, description, image, and favicon. You can also type /bookmark in the editor. The preview is captured once when you add it, so readers never trigger a refetch.

    Safety: cards always open in a new tab, and following a card to a site outside yroun.com shows a confirmation with the real destination domain first.

    Adding a widget to a page

  • Open a hub page in edit mode.
  • Type / on a blank line to open the block picker.
  • Search for 'table', 'chart', 'stat', 'request', 'queue', or 'faq' and select the widget.
  • Select the settings icon (gear) to configure the endpoint and auth.
  • Save the page. The widget is live for all readers.
  • Endpoint presets

    Instead of pasting a full URL into every widget, you can define named base URL presets at the hub level and reference them by name.

  • Go to your hub → Settings → Endpoints.
  • Select Add endpoint. Give it a name (e.g. 'Main API') and a base URL (e.g. 'https://api.example.com').
  • In any widget config, select that name from the 'Endpoint preset' dropdown.
  • Set the 'Path' field to the specific path (e.g. '/v1/users').
  • The widget resolves the full URL as base + path at request time.
  • Endpoint presets are per-hub. If you update a preset URL, all widgets referencing it pick up the change automatically, no individual widget edits needed.

    Choosing an auth mode: one question decides it

    Who controls the API the widget calls? That single question picks the right mode. Our recommendation order:

  • It's YOUR OWN server → Yroun ID (best). Don't store any key anywhere, not at Yroun, not in browsers. Your server verifies Yroun's short-lived token and you get a per-viewer pseudonymous id for free. This is the strongest option precisely because there is no credential to protect.
  • It's a THIRD-PARTY API you can't modify (key-based) → CONNECTION. A key has to live somewhere; a Connection keeps it encrypted on Yroun's server and injects it server-side per request. It never reaches any browser. Picked in the endpoint selector, not the auth tabs.
  • Each viewer brings THEIR OWN token → PERSONAL TOKEN, at one of two persistence levels: SAVED (authSource shared: the viewer's token is stored in their per-hub vault under sharedKeyName and remembered across visits/devices; viewers without one get an in-widget prompt) or THIS SESSION (authSource local: browser-only, nothing stored at Yroun). Nothing here is shared between viewers. A hub-held secret belongs in a CONNECTION, never in a personal token name.
  • Details for each mode follow.

    Authorization modes

  • Yroun ID: Yroun issues a short-lived identity token (5 min) for every signed-in viewer and sends it as Authorization: YrounWidget <token>. The token carries a per-hub pseudonymous viewer id, never the Yroun account id, so your server can tell viewers apart without receiving any personal identifier. Verify it with your own API key at api.yroun.com (POST /oapi/widget-tokens/verify); the token cannot be used on Yroun APIs.
  • PERSONAL TOKEN (saved) · authSource shared: the VIEWER's own token, saved in their per-hub vault under sharedKeyName and injected into the configured header. Each viewer holds their own; missing-token viewers see an in-widget add prompt. Not for hub-shared secrets. Use a CONNECTION for those.
  • MANUAL: the user enters their own credential once per session in a local prompt. The credential is stored only in the browser, never on Yroun servers.
  • Yroun ID auth: how it works

    When Yroun ID mode is active, Yroun issues a short-lived identity token (5 minutes) for every signed-in viewer and sends it to your API as Authorization: YrounWidget <token>. The token's subject is a pairwise viewer id, stable for the same viewer on the same hub, but different across hubs and never linkable to the Yroun account. Anonymous visitors send no token. The token is scoped only for identity verification. It cannot be used to call Yroun's own APIs.

    Your backend verifies it with your own API key. Each verification is metered against your credits, never the viewer's:

    # Verify a Yroun widget token from your own server
    curl -X POST https://api.yroun.com/oapi/widget-tokens/verify \
      -H "X-API-Key: yroun_key_xxxxxxxxxxxx" \
      -H "Content-Type: application/json" \
      -d '{ "token": "<value after the YrounWidget prefix>" }'
    // 200: verdict is in the body, not the status code
    { "valid": true, "viewerId": "3f9c…32-hex, stable per (viewer, hub)", "hubUid": "…" }
    
    // expired or forged token
    { "valid": false, "viewerId": null, "hubUid": null }
  • The token expires in 5 minutes. The widget automatically fetches a new one before expiry.
  • The token cannot be used on api.yroun.com, only for identity verification.
  • Every signed-in viewer gets a token. Anonymous visitors send no token. Treat those requests as anonymous.
  • You may cache a verification for the token's 5-minute lifetime, no need to re-verify per request.
  • This lets you build per-viewer experiences on your own API, such as personalization, rate limiting or your own access rules keyed on viewerId, and display them securely inside a Yroun hub page, without sharing any Yroun credentials with your server.

    Header format

    For SESSION and PERSONAL TOKEN modes you can customise the header name and method prefix:

  • Header Name: default Authorization.
  • Method (Prefix): default YrounWidget for Yroun ID, Bearer for PERSONAL TOKEN modes. Leave empty if your API expects a raw token with no prefix.
  • Example: Header Name = X-My-Token, Method = (empty) → X-My-Token: <token>

    CONNECTIONS: server-side proxy (recommended)

    A Connection stores an external API credential once at hub level; widgets that select it fetch through Yroun's server, which injects the secret per request. The secret is encrypted at rest and never sent to any browser.

  • Go to your hub → More → Connections and select Add Connection.
  • Set a name (e.g. 'weatherapi'), the Base URL of the API, the auth header (default Authorization) and scheme (e.g. Bearer), and paste the secret.
  • Choose who can use it: Owner & Admins (default), Members, or Everyone.
  • In a widget's endpoint selector, pick the connection from the Connections group and enter the sub-path (e.g. '/v1/report').
  • Save. Viewers within the access level see live data with zero setup. The credential never leaves Yroun's server.
  • Only http(s) URLs to public hosts are accepted; requests to private/internal network ranges are rejected by the proxy.

    Viewer identity on proxied requests: when a signed-in reader triggers the fetch, the proxy adds X-Yroun-Viewer (the same per-hub pairwise viewerId that widget-token verification returns) and X-Yroun-Hub headers to the outbound request, so your API gets the server-held credential AND per-viewer identity together. Anonymous viewers and machine callers send neither header; absent means anonymous.

    PERSONAL TOKEN (saved): step-by-step walkthrough

    A saved personal token is the right choice when each viewer should call the data source with THEIR OWN credential, e.g. everyone on the team has their own token for an internal service, or a per-user third-party API key. Nothing is shared between viewers: the widget names a token (sharedKeyName), and every viewer supplies their own under that name. For ONE hub-held secret that serves all viewers, use a CONNECTION instead.

  • In the widget's auth config, open the MY TOKEN · SAVED tab and pick (or type) the token name.
  • Set Header Name / Method if your API expects something other than Authorization: Bearer.
  • Save. Each viewer's OWN token (stored in their personal vault, hub → More → Vault) is sent on their fetches.
  • Viewers who have not added a token under that name see an in-widget prompt with the exact name prefilled. One paste and the widget loads.
  • Prefer read-only credentials. A viewer's token is used for every fetch of every widget naming it in this hub.
  • Rotating: each viewer edits their own vault entry's value once; every widget referencing the name picks it up, no widget edits.
  • Personal tokens + endpoint presets compose: a widget with endpointRef 'Main API' + token name 'analytics-readonly' is fully portable across pages.
  • API Table: column mapping

    After entering the API URL, select 'Fetch columns' to auto-detect fields from the response. Map each field to a column label and choose a display type: text, number, date, or badge. Use 'Data root key' if the array is nested: e.g. data.items returns the items array.

    Pagination, filters, total count

    The API Table widget assumes a page-based contract by default: page number + size as query params, content + totalElements in the response. Filters become extra query params, one per filter control. Sorting passes a sort param, with a leading '-' for descending.

    # Default request shape the widget sends
    GET https://your-api.example.com/items?page=1&size=20&sort=-createdAt&status=ACTIVE
    
    # Default response shape the widget expects
    {
      "content":       [ { ... }, { ... } ],
      "totalElements": 1234,
      "totalPages":    62,
      "pageNumber":    1,
      "pageSize":      20
    }
  • pageNumber is 0-indexed by default, which is what Spring's Page<T> and Elasticsearch from expect. Those work untouched. Set 'Page start offset' = 1 only if your API counts pages from 1 (Laravel-style).
  • If totalElements is absent, the widget shows row count instead of total and disables page navigation. It never invents a total it cannot prove.
  • Cursor APIs are also supported via the apiMapping fields described below.
  • apiMapping: adapt the widget to any API shape

    Query and response field names are NOT hardcoded. Every widget instance exposes an apiMapping config block that remaps the widget's six logical fields onto whatever your backend uses. This is the widget's headline strength: you can point it at an API you already shipped, such as your own service, a third-party REST endpoint or an internal analytics service, without changing a single line of backend code.

    The six logical fields (and their defaults):

    {
      "apiMapping": {
        // request: where the widget puts the value
        "reqPageNum":  "page",      // query param name for page number
        "reqPageSize": "size",      // query param name for page size
        "reqSort":     "sort",      // query param name for sort
        "reqSearch":   "search",    // query param name for the search box
    
        // response: where the widget reads the value (dot path)
        "resItems":    "content",         // array of rows
        "resTotal":    "totalElements"    // total row count
      }
    }

    Concrete remaps. Same widget, three completely different APIs:

    // Your existing Express API returns { rows, total, currentPage }
    { "reqPageNum": "p", "reqPageSize": "limit",
      "resItems": "rows", "resTotal": "total" }
    
    // A third-party API returns { data: { results, count }, meta: {...} }
    { "reqPageNum": "page", "reqPageSize": "per_page",
      "resItems": "data.results", "resTotal": "data.count" }
    
    // An Elasticsearch-backed endpoint returns { hits: { hits, total: { value } } }
    { "reqPageNum": "from", "reqPageSize": "size",
      "resItems": "hits.hits", "resTotal": "hits.total.value" }
  • resItems / resTotal accept dot paths. Drill into nested response objects without rewriting the API.
  • Leaving resTotal blank tells the widget there is no total. It shows row count and disables page navigation, no fake numbers.
  • Changing apiMapping is a widget-config edit only; nothing redeploys.
  • The strategic upside: the widget is the integration boundary, not the API. New backends, partner APIs, and legacy services all plug in via config.
  • CRUD response shapes

    Inline create / edit / delete row actions follow standard REST conventions:

    POST   /items         → 201 Created with the created row in the body
    PATCH  /items/{id}    → 200 OK   with the updated row in the body
    DELETE /items/{id}    → 204 No Content (empty body)

    Errors return { error, message } with a 4xx status. The widget surfaces the message in the row's inline error banner, never silently.

    API Chart: filter controls

    Add filter controls to let readers slice the chart data without editing the widget. Each filter maps to a URL query parameter. When the reader changes a filter, the widget re-fetches and re-renders.

    API Request: body modes

  • None: no body (GET, DELETE).
  • Form: key/value pairs sent as application/x-www-form-urlencoded.
  • JSON: raw JSON body with optional template variables like {{field_name}}.
  • API Queue: grouped work queues

    API Queue turns any paginated list endpoint into a status-grouped operator queue: rows are bucketed by a field you choose (typically status), each group gets a colored badge and header, and the widget re-fetches on an interval so state changes appear without a manual refresh. Selecting a row emits a page-level event that sibling widgets can listen to, and can optionally navigate to a URL template built from the row.

    Inserting one from the block picker starts it pre-wired to a public sample endpoint grouped by status. Swap in your own endpoint when ready.

    To configure it right in the page editor, select the gear icon in the widget header: the inline settings panel puts the essentials up front (title, API URL, auth, group-by field) and keeps the response mapping, polling/row tuning, and the JSON fields (group labels, badge colors, row columns) under an Advanced toggle. Everything can also be set programmatically via the block attrs below.

    Key configuration (all editable per widget):

  • apiUrl / endpoint preset + apiMapping: the same contract as API Table, so you can point the widget at any list endpoint and remap resItems / resTotal / reqPageNum / reqPageSize to your shape.
  • groupByField: the row field to bucket by (e.g. status). Rows sharing a value form one group.
  • groupOrder / groupLabels / groupBadgeColors: display order, pretty labels (e.g. '✅ Ready'), and badge color per group value. Unknown values render after the configured ones.
  • rowColumns: which row fields to show, in order; a column with type 'datetime' renders a relative age ('3m ago').
  • pollIntervalSec: auto-refresh interval (default 30s).
  • perGroupMax: cap per group so a huge backlog can't flood the page (default 20).
  • clickNavigateTemplate: optional URL template interpolated with row fields, e.g. '?item={uid}' to drive a sibling detail widget on the same page.
  • API Queue is an operator surface: it fetches only for the hub owner and admins. Regular readers see the widget frame without data. Put it on an admin/staff-visibility page rather than a public one.

    Stuck, or something here is wrong? Send us a message