Customer Visual Embeds & Whitelabeling Guide
B2B SaaS platforms frequently need to deliver customer-facing usage metrics, billing trends, and IoT sensor streams. Traditional implementations require embedding heavy 200 KB+ charting packages (Recharts, Chart.js, D3), configuring state managers, and maintaining backend database proxy endpoints.
TimesinkDB eliminates frontend charting overhead by serving charts directly from .html and .svg URLs. Server-side rendering generates standalone, interactive vector charts directly over HTTP—embedded via a single <iframe /> or <img /> element with zero JSON egress consumption.
No Recharts, Chart.js, or Canvas dependencies in your bundle. Save hundreds of kilobytes in client bundle size.
Server-rendered HTML iframe widgets and SVG vector charts are excluded from your monthly JSON/CSV API egress quota.
Database-scoped tokens (tok_ro_...) enable safe browser embeds for isolated databases, or 5-line SSR SVG fetches for shared multi-tenant DBs.
Scoped Read-Only Tokens (tok_ro_...) & Multi-Tenant Isolation
Security is critical when rendering charts in customer-facing browsers. You must never expose your database master secret key (sec_live_...) in client-side HTML or JavaScript.
- Permitted (Database-Wide Read):
GET&POST /databases/{databaseId}/query,GET /databases/{databaseId}/series,GET /databases/{databaseId}/series/{seriesKey},GET /databases/{databaseId}/retention/rules, and all projections (.html,.svg,.json,.csv) across the target database. - Strictly Blocked: All ingestion writes (
POST /databases/{databaseId}/series/...,POST /databases/{databaseId}/ingest), catalog deletions, retention rules updates, or key rotations. Attempting to write with a read token rejects immediately with HTTP403 Forbidden. - URL Safe: Pass tokens directly in embed URLs via
?token=tok_ro_...for zero-header iframe loading when the entire database shares the same read boundary.
Use direct client-side ?token=tok_ro_... URLs when all series inside that database share the same read boundary: public status pages, internal team dashboards (Retool, Notion, Grafana), or per-customer isolated databases provisioned via Pro/Scale Multi-DB pooling.
Because tok_ro_... authorizes reads across the entire database catalog, never expose a shared multi-tenant database's tok_ro_... to the browser if Tenant A and Tenant B share databases/42. Instead, fetch the .svg chart server-side in a Next.js Server Component or API route—pinning seriesKey to the authenticated tenant session while still enjoying $0.00 embed egress.
Unmetered Embed Egress ($0.00) & Interval-Adaptive Edge Caching
Interactive SVG and HTML chart embeds consume 0 GB of your monthly egress quota. Outbound egress quotas apply exclusively to programmatic, raw JSON and CSV analytical queries (.json, .csv).
To deliver sub-millisecond global rendering while keeping live streams fresh, .svg and .html endpoints automatically emit interval-adaptive Cache-Control headers (s-maxage=5 for 10-second or shorter intervals, s-maxage=15 for intervals up to 1 minute, and s-maxage=60 for intervals above 1 minute or auto, with stale-while-revalidate).
Whitelabeling, Custom Hex Accents & Themes
All plans support custom hex accent colors (?color=%2310b981) and dark/light themes (?theme=dark|light). Free Sandbox and Starter embeds display a subtle Powered by TimesinkDB footer badge, while Pro ($35/mo), Scale ($85/mo), Dedicated Node, and Custom (≥$35/mo) remove the watermark completely. Scale, Dedicated Node, and Custom (≥$85/mo) also support custom CNAME domains (e.g., metrics.yourdomain.com).
Embed URL Parameters & Brand Styling Reference
Visual embeds (.html and .svg) accept declarative URL parameters for time ranges, styling, dimensions, interval aggregation, and token authentication:
| Parameter | Default | Options / Values | Description & Behavior |
|---|---|---|---|
| token | required | tok_ro_... |
Database-scoped read-only token allowing safe browser embed authorization without secret keys. |
| from | -1h | -1h, -24h, -7d, -30d, ISO-8601, or Unix ms |
Inclusive start of the query time window (relative lookback duration or absolute timestamp; defaults to -1h on visual projections). |
| to | now | now, ISO-8601, or Unix ms |
Inclusive end of the query time window (defaults to current server time now). |
| theme | dark | dark | light |
Dark theme (#09090b background) or light theme (#ffffff background). Supported on all tiers. |
| chart / type | line | line | area | bar | step |
Visual chart style: vector polyline, gradient area fill, column bar chart, or step chart. |
| color | theme default | Hex or comma-separated list (e.g. %2310b981 or %23f97316,%230ea5e9) |
Custom 3-, 6-, or 8-digit hex accent color (or comma-separated multi-series color palette) for chart stroke, points, and area gradient. Supported on all tiers. |
| width / height | 800 / 360 | 100..3840 / 60..2160 |
SVG viewBox and canvas dimensions in pixels (clamped safely on the server). |
| title | seriesKey | URL-encoded string | Custom chart header title (defaults to the queried seriesKey). |
| interval | auto | auto, 1m, 5m, 15m, 1h, 1d |
Bucket downsampling duration. auto dynamically selects ~120 human-readable visual bins based on the [from, to] window. |
| fn | avg | avg, sum, min, max, count, first, last, delta, rate, integral, timeweightedavg, p<N> |
Aggregation function per bucket, including arbitrary read-time percentiles (p50, p90, p95, p99, p99.9). |
| fill | none | none | null | previous | <number> |
Empty bucket handling on downsampled visual projections (.svg and .html): none (default, omits empty buckets), null (emits all buckets across [from, to] with a visual gap), previous (last observation carried forward), or a constant numeric fill (e.g. 0). |
| seriesKey / q | path key | Single key, glob pattern (fleet.*.speed), or comma-separated keys (us.lat,eu.lat) |
On GET /databases/{id}/query.svg and /query.html, pass a wildcard glob pattern to aggregate across matching series or comma-separated series keys (up to 16) to plot multi-series comparison overlays with color=%23f97316,%230ea5e9. |
React & Next.js Component Recipes
Copy & Paste
Choose the pattern that matches your database tenancy boundary—either a direct client-side <iframe /> for dedicated per-tenant databases and internal dashboards, or a 5-line Next.js Server Component that keeps tok_ro_... on the server when multiple tenants share a single database:
// Pattern A: Per-Tenant Isolated DB or Internal Dashboard (Direct Client <iframe />)
// components/CustomerMetricChart.tsx
import React from 'react';
interface Props {
databaseId?: string | number; // Dedicated tenant DB ID (e.g. "42")
serviceName: string; // e.g. "checkout" or "payments"
metric: string; // e.g. "requests" or "p99_latency_ms"
readToken: string; // Database-scoped "tok_ro_..." for this tenant's DB
range?: string; // "-24h", "-7d", "-30d"
theme?: 'dark' | 'light';
chartType?: 'line' | 'area' | 'bar' | 'step';
accentColor?: string; // e.g. "#10b981"
}
export function CustomerMetricChart({
databaseId = '42',
serviceName,
metric,
readToken,
range = '-30d',
theme = 'dark',
chartType = 'line',
accentColor = '#ff5b45'
}: Props) {
const encodedColor = encodeURIComponent(accentColor);
const chartUrl = `https://fra1.timesinkdb.com/databases/${databaseId}/series/api.${serviceName}.${metric}.html`
+ `?from=${range}&interval=auto&theme=${theme}&chart=${chartType}&color=${encodedColor}&token=${readToken}`;
return (
<div className="w-full h-64 rounded-xl overflow-hidden border border-neutral-800 bg-neutral-950 shadow-inner">
<iframe
src={chartUrl}
title={`Metric: ${metric}`}
className="w-full h-full border-0 select-none"
loading="lazy"
sandbox="allow-scripts allow-same-origin"
/>
</div>
);
}
// Pattern B: Shared Multi-Tenant Database (Next.js Server Component — 0 Client Token Exposure, $0 Egress)
// app/dashboard/TenantUsageChart.tsx
import { getAuthenticatedTenantId } from '@/lib/auth';
export async function TenantUsageChart({ range = '-30d' }: { range?: string }) {
const tenantId = await getAuthenticatedTenantId(); // Pinned on server from session cookie/JWT
const res = await fetch(
`https://fra1.timesinkdb.com/databases/42/series/tenants.${tenantId}.requests.svg?from=${range}&interval=auto&chart=area&theme=dark`,
{ headers: { Authorization: `Bearer ${process.env.TIMESINK_READ_TOKEN}` }, next: { revalidate: 15 } }
);
const svgMarkup = await res.text();
return (
<div
className="w-full rounded-xl overflow-hidden border border-neutral-800 bg-neutral-950 [&>svg]:w-full [&>svg]:h-auto"
dangerouslySetInnerHTML={{ __html: svgMarkup }}
/>
);
}
// Note: Under strict Content Security Policies (CSP), you can alternatively return the upstream
// .svg response from a Next.js Route Handler (Content-Type: image/svg+xml) and render it via <img src="/api/charts/usage" />.
Retool & Internal Dashboard Recipe
Internal ops and support teams often need to inspect live service or device telemetry inside Retool, Superblocks, or internal dashboards without building dedicated backend APIs.
- Drag an Iframe component onto your Retool canvas.
- In the Iframe URL field, enter the projected endpoint bound to your selected row:
https://fra1.timesinkdb.com/databases/42/series/api.{{ table1.selectedRow.service_key }}.latency_ms.html?from=-24h&token={{ current_user.metadata.tsdbToken }}
The chart updates dynamically whenever an operator selects a row, rendering live telemetry without touching your primary production database.
Notion, GitHub README & Static Markdown (.svg)
Because TimesinkDB projects directly into vector .svg images, you can embed live metric sparklines inside standard markdown files, GitHub pull request descriptions, and Notion company wikis:
<!-- Single-Series GitHub README / Notion Embed (Auto-refreshes on view) -->

<!-- Multi-Series Regional Comparison Overlay (Comma-separated seriesKey + color palette) -->

Next Guides to Explore
Ready to ship customer-facing charts? Reserve your 1 GB Free Sandbox.
Includes unlimited fair-use HTML & SVG chart embeds ($0.00 egress), 1,000 active series, and $0.00 write fees with no credit card required.