/ Docs
Home App

LiveInk Widget Documentation

Embed real-time financial data into any website with a single script tag. No backend required.

Getting Started

The LiveInk Widget is a lightweight, self-contained JavaScript snippet that automatically updates financial data displayed on your website. It works with any HTML page — no framework, no build step, no dependencies.

How it works:

  1. You include the widget script on your page with your API key.
  2. You mark HTML elements with data-liveink attributes specifying the data type.
  3. The widget automatically fetches real-time data and updates those elements at the interval you configure.
  4. Tooltips show the original value, source, and last update time.
Note The widget is entirely client-side. It communicates with the LiveInk API via secure HTTPS requests. No server-side code is required on your end.

Quick Start

Add the widget to your page in two steps:

Step 1 — Include the script

HTML
<script src="https://api.liveink.app/widget.js"
        data-key="LIK-xxxx-xxxx-xxxx"
        data-refresh="300"></script>

Step 2 — Add data attributes to your elements

HTML
<!-- Bitcoin price in USD -->
<span data-liveink="bitcoin_usd"
      data-liveink-prefix="$"
      data-liveink-decimals="0">Loading...</span>

<!-- EUR/USD exchange rate -->
<span data-liveink="eur_usd"
      data-liveink-decimals="4">Loading...</span>

<!-- Oil price with suffix -->
<span data-liveink="oil_wti"
      data-liveink-prefix="$"
      data-liveink-suffix=" /barrel"
      data-liveink-decimals="2">Loading...</span>

That’s it. The widget will automatically validate your key, fetch fresh data, and keep values updated.

Authentication

Every request to the LiveInk API requires a valid API key, passed via the data-key attribute on the script tag. The widget handles authentication automatically.

Key format

API keys follow the pattern LIK-xxxx-xxxx-xxxx where each segment is an alphanumeric string.

Domain restriction

Each key is bound to one or more allowed domains. Requests from unauthorized domains will be rejected with a DOMAIN_NOT_ALLOWED error. Wildcards (*) are supported for development.

Validation flow

Sequence
1. Widget loads
2. POST /api/widget/validate  Headers: X-LiveInk-Key: LIK-xxxx-xxxx-xxxx
3. Server checks:
   - Key exists and is active
   - Key has not expired
   - Request origin matches allowed domains
   - Daily request limit not exceeded
4. If valid -> fetch data  |  If invalid -> console warning

HTML Attributes

Use these attributes on any HTML element to control widget behavior:

Script tag attributes

AttributeRequiredDefaultDescription
data-keyYesYour LiveInk API key (LIK-xxxx-xxxx-xxxx)
data-refreshNo300Auto-refresh interval in seconds (0 = disabled)
data-tooltipNotrueSet to "false" to disable hover tooltips
data-badgeNotrueSet to "false" to hide the “LiveInk” badge
data-colorNo#2563EBAccent color for underlines and tooltips

Element attributes

AttributeRequiredDefaultDescription
data-liveinkYesThe data type to display (see Available Data Types)
data-liveink-prefixNo""Text prepended to the value (e.g., "$", "€")
data-liveink-suffixNo""Text appended to the value (e.g., " USD", " /barrel")
data-liveink-decimalsNoautoNumber of decimal places (auto: 0 for ≥100, 2 for ≥1, 4 for <1)
data-liveink-formatNonumberSet to "raw" to display the raw API value without formatting
data-liveink-localeNo"en-US"Number formatting locale (e.g., "it-IT" for 1.234,56)
data-liveink-fallbackNo""Text shown if the value cannot be fetched

Available Data Types

Each data-liveink value maps to a specific data feed. Data is fetched in batches and cached with category-specific TTLs (see the Refresh column below).

Cryptocurrency

Real-time prices from CoinGecko API (free tier, no key required).

Data TypeDescriptionRefreshPlans
bitcoin_usdBitcoin price in US Dollars60sBasic Pro Enterprise
bitcoin_eurBitcoin price in Euros60sBasic Pro Enterprise
ethereum_usdEthereum price in US Dollars60sBasic Pro Enterprise
ethereum_eurEthereum price in Euros60sBasic Pro Enterprise
solana_usdSolana price in US Dollars60sBasic Pro Enterprise

Forex

Exchange rates from ECB via ExchangeRate-API (free, updated daily).

Data TypeDescriptionRefreshPlans
eur_usdEuro to US Dollar exchange rate300sBasic Pro Enterprise

Energy / Commodities

Commodity prices from Yahoo Finance (real-time market data).

Data TypeDescriptionRefreshPlans
oil_wtiWTI Crude Oil price (USD/barrel)900sPro Enterprise
oil_brentBrent Crude Oil price (USD/barrel)900sPro Enterprise

Precious Metals

Spot prices from Metals API and market aggregators.

Data TypeDescriptionRefreshPlans
gold_usdGold (USD/troy ounce)900sPro Enterprise
silver_usdSilver (USD/troy ounce)900sPro Enterprise
platinum_usdPlatinum (USD/troy ounce)900sPro Enterprise
palladium_usdPalladium (USD/troy ounce)900sPro Enterprise

Agriculture

Agricultural commodity prices from Commodities API.

Data TypeDescriptionRefreshPlans
wheat_usdWheat (USD/bushel)3600sPro Enterprise
coffee_usdCoffee (USD/lb)3600sPro Enterprise
cocoa_usdCocoa (USD/ton)3600sPro Enterprise
sugar_usdSugar (USD/lb)3600sPro Enterprise

Stock Indices

Major global stock indices from Yahoo Finance.

Data TypeDescriptionRefreshPlans
sp500S&P 500300sPro Enterprise
nasdaqNASDAQ Composite300sPro Enterprise
ftse_mibFTSE MIB (Italy)300sPro Enterprise
daxDAX (Germany)300sPro Enterprise
cac40CAC 40 (France)300sPro Enterprise
nikkeiNikkei 225 (Japan)300sPro Enterprise
dow_jonesDow Jones Industrial Average300sPro Enterprise

Interest Rates

Central bank reference rates, updated after each policy meeting.

Data TypeDescriptionRefreshPlans
ecb_rateECB Main Refinancing Rate3600sPro Enterprise
fed_rateUS Federal Funds Rate3600sPro Enterprise
boe_rateBank of England Base Rate3600sPro Enterprise

Macro Economics

Key macroeconomic indicators, sourced from national statistics offices and international organizations.

Data TypeDescriptionRefreshPlans
inflation_usUS Inflation Rate (%)86400sPro Enterprise
inflation_euEurozone Inflation Rate (%)86400sPro Enterprise
inflation_itItaly Inflation Rate (%)86400sPro Enterprise
gdp_usUS GDP Growth Rate (%)86400sPro Enterprise
gdp_euEurozone GDP Growth Rate (%)86400sPro Enterprise
unemployment_usUS Unemployment Rate (%)86400sPro Enterprise
unemployment_itItaly Unemployment Rate (%)86400sPro Enterprise

Weather

Current temperature data from OpenWeatherMap and Open-Meteo.

Data TypeDescriptionRefreshPlans
weather_romeTemperature in Rome (°C)1800sEnterprise
weather_milanTemperature in Milan (°C)1800sEnterprise
weather_londonTemperature in London (°C)1800sEnterprise
weather_new_yorkTemperature in New York (°C)1800sEnterprise
weather_tokyoTemperature in Tokyo (°C)1800sEnterprise

Air Quality

Air Quality Index from WAQI / aqicn.org.

Data TypeDescriptionRefreshPlans
aqi_romeAir Quality Index — Rome3600sEnterprise
aqi_milanAir Quality Index — Milan3600sEnterprise
aqi_londonAir Quality Index — London3600sEnterprise

Earthquake

Latest significant seismic events from USGS Earthquake API.

Data TypeDescriptionRefreshPlans
earthquake_latestLatest significant earthquake (magnitude + location)300sEnterprise

Demographics

Population data from World Bank and national statistics offices.

Data TypeDescriptionRefreshPlans
population_italyItaly population86400sEnterprise
population_usUS population86400sEnterprise
population_worldWorld population86400sEnterprise

Code Examples

Basic article with live data

HTML
<article>
  <h1>Market Update</h1>
  <p>
    Bitcoin is currently trading at
    <span data-liveink="bitcoin_usd"
          data-liveink-prefix="$"
          data-liveink-decimals="0">...</span>,
    while Ethereum sits at
    <span data-liveink="ethereum_usd"
          data-liveink-prefix="$"
          data-liveink-decimals="2">...</span>.
  </p>
  <p>
    The EUR/USD exchange rate is at
    <span data-liveink="eur_usd"
          data-liveink-decimals="4">...</span>,
    and WTI Oil is at
    <span data-liveink="oil_wti"
          data-liveink-prefix="$"
          data-liveink-suffix=" per barrel"
          data-liveink-decimals="2">...</span>.
  </p>
</article>

<!-- Widget script (place before </body>) -->
<script src="https://api.liveink.app/widget.js"
        data-key="LIK-xxxx-xxxx-xxxx"></script>

Dashboard-style data cards

HTML
<div class="dashboard">
  <div class="card">
    <h3>BTC</h3>
    <span data-liveink="bitcoin_usd"
          data-liveink-prefix="$"
          data-liveink-decimals="0"></span>
  </div>
  <div class="card">
    <h3>ETH</h3>
    <span data-liveink="ethereum_usd"
          data-liveink-prefix="$"
          data-liveink-decimals="2"></span>
  </div>
  <div class="card">
    <h3>EUR/USD</h3>
    <span data-liveink="eur_usd"
          data-liveink-decimals="4"></span>
  </div>
</div>

Custom styling and no badge

HTML
<!-- Red accent, no badge, 1-minute refresh -->
<script src="https://api.liveink.app/widget.js"
        data-key="LIK-xxxx-xxxx-xxxx"
        data-refresh="60"
        data-badge="false"
        data-color="#ef4444"></script>

Italian locale formatting

HTML
<p>Il Bitcoin vale attualmente
  <span data-liveink="bitcoin_eur"
        data-liveink-prefix="€"
        data-liveink-decimals="0"
        data-liveink-locale="it-IT"></span>.
  L'oro è a
  <span data-liveink="gold_usd"
        data-liveink-prefix="$"
        data-liveink-decimals="2"
        data-liveink-locale="it-IT"
        data-liveink-suffix=" l'oncia"></span>.
</p>

Fallback for unavailable data

HTML
<p>Terremoto più recente:
  <span data-liveink="earthquake_latest"
        data-liveink-fallback="Nessun evento recente">Caricamento…</span>
</p>
<p>Qualità aria Roma: AQI
  <span data-liveink="aqi_rome"
        data-liveink-fallback="non disponibile"></span>
</p>

Widget Behavior

Initialization

  1. The script loads and reads configuration from data-* attributes.
  2. CSS is injected for underlines, tooltips, flash animation, and the badge.
  3. The API key is validated via POST /api/widget/validate.
  4. If valid, the first data fetch is triggered immediately.
  5. Subsequent fetches run at the data-refresh interval (default: 300s).

Update cycle

  1. The widget scans the DOM for all elements with data-liveink.
  2. It saves the original text content as data-liveink-original.
  3. A single batch request is sent to POST /api/widget/update.
  4. Returned values are formatted and injected into each element.
  5. Changed values trigger a brief blue flash animation (.li-flash).

Tooltips

On hover, a tooltip shows the current value, the original value, the data source, and the last update timestamp. Tooltips follow the cursor position and appear above the element.

Tip Set data-tooltip="false" on the script tag if your page already has its own tooltip system to avoid conflicts.

Styling

The widget injects minimal CSS. You can override any style with standard CSS specificity.

Default styles applied

SelectorDescriptionCustomizable
[data-liveink]Blue underline (border-bottom: 2px solid), help cursorYes — override with CSS
[data-liveink]:hoverLight blue background on hoverYes
.li-flashFlash animation on value change (0.6s ease-out)Yes — redefine @keyframes liFlash
.li-tpTooltip container (dark background, white text)Yes — override .li-tp
.li-badge“LiveInk” badge (fixed bottom-right)Yes — or set data-badge="false"

Status attributes

The widget sets a data-liveink-status attribute on each element, which you can use to style different states:

StatusDescription
loadingInitial state — waiting for API response
liveValue successfully fetched and displayed
errorValue could not be fetched
CSS
[data-liveink-status="live"]    { color: #16a34a; }
[data-liveink-status="error"]   { color: #dc2626; opacity: 0.6; }
[data-liveink-status="loading"] { color: #94a3b8; }

Override example

CSS
/* Remove the underline */
[data-liveink] {
  border-bottom: none;
  font-weight: 700;
  color: #2563EB;
}

/* Custom flash animation */
@keyframes liFlash {
  0%   { background: rgba(34,197,94,.3); }
  100% { background: transparent; }
}

Rate Limits

Rate limits are applied per API key on a daily basis. Counters reset at midnight UTC.

PlanRequests / DayDomains
Basic1,0001
Pro10,0005
Enterprise100,00050
Warning If you exceed the daily limit, the API returns 429 RATE_LIMIT_EXCEEDED. The widget will silently stop updating until the next day. Plan upgrades take effect immediately.

Error Handling

The widget handles errors gracefully. All errors are logged to console.warn and never displayed to end users.

Error CodeHTTPCauseResolution
MISSING_KEY401No data-key attribute on script tagAdd your API key
INVALID_KEY401Key not found in the databaseCheck the key is correct
KEY_DISABLED403Key has been deactivatedContact support
KEY_EXPIRED403Key past expiration dateRenew your subscription
DOMAIN_NOT_ALLOWED403Origin domain not in the allow listAdd the domain in your dashboard
RATE_LIMIT_EXCEEDED429Daily request quota exhaustedUpgrade plan or wait until midnight UTC
NO_ELEMENTS400Empty elements array in request bodyEnsure data-liveink elements exist in DOM

Subscription Plans

FeatureBasicProEnterprise
Monthly price€9.99€29.99€99.99
Yearly price€99.99€299.99€999.99
Requests / day1,00010,000100,000
Domains1550
Crypto (BTC, ETH, SOL)
Forex (EUR/USD)
Commodities (Oil WTI, Brent)
Macro data
News data
Custom entities
Priority support
Yearly discount Save ~17% with yearly billing on all plans.

Support

If you need help integrating the widget or have questions about your account:

Enterprise customers have access to priority support with guaranteed 4-hour response time during business hours (CET).


© 2026 LiveInk. All rights reserved. — Back to Home