Widget
Custom JS
Write a small JavaScript snippet that fetches from any API and returns a value. The script runs on a schedule and its return value is displayed live on your dashboard.
What it is for
Use Custom JS when no built-in widget type covers your data source. Pull from a REST API, scrape a JSON endpoint, compute a derived metric, or chain multiple fetches. Any value you can express in async JavaScript becomes a live widget.
How to add it
- Click + Add widget and select Custom JS.
- Write your script in the code editor. The script must return (or resolve to) the value you want to display.
- Save. The script runs immediately and shows the result.
Script format
const res = await fetch('https://api.example.com/value')
const data = await res.json()
return { result: data.price }Configuration
| Field | Description |
|---|---|
| Label | Display name on the widget. |
| JavaScript | Async function body. Must return { result, down }. Has access to fetch, URL, and URLSearchParams. |
Tips
- The script runs in a sandboxed Node.js environment with
fetchavailable. - Keep scripts under a few seconds; they time out at 10s.
- Return a plain string or number for text display, or an array of objects for table/chart display.
Display options
Text, line chart, bars, or event feed (if returning an array of timestamped entries).
Credit cost
0.02 credits per check
Histogram
Error rate by type
TypeError
TypeError404Timeout500
09:18 PM · 5m
JSValue
GitHub stars
18,392
09:18 PM · 1h
JS