Data API

Pull your entitled dashboard data programmatically over HTTP. The Data API serves the same data and respects the same entitlements as the data4x app, so anything you can see in your workspace you can fetch with a key.

Authentication

Every request is authenticated with a bearer token. Send your key in the Authorization header:

Authorization: Bearer d4x_live_...

Create and manage keys from the API keys page (requires sign-in). Keys act on behalf of your workspace and carry your subscription's entitlements.

Base URL

All endpoints below are relative to this base:

https://data4x-api-5jiit27kka-ey.a.run.app/api/v1

Call the API at this host directly — not the app origin.

Endpoints

EndpointDescriptionCost
GET /dashboardsList the dashboards you can access (pages + widget metadata).Free
GET /dashboards/{slug}Full definition for a single dashboard.Free
GET /dashboards/{slug}/pages/{pageId}All widgets' data for a page. Filter via query params.api.page_read
GET /dashboards/{slug}/pages/{pageId}/widgets/{widgetId}Data for a single widget on a page. Cheaper than a full page.api.widget_read
GET /openapi.jsonMachine-readable OpenAPI 3 spec. No key required.Free

Examples

List the dashboards you can access:

curl -H "Authorization: Bearer YOUR_KEY" \
  https://data4x-api-5jiit27kka-ey.a.run.app/api/v1/dashboards

Fetch a page's data with a filter:

curl -H "Authorization: Bearer YOUR_KEY" \
  "https://data4x-api-5jiit27kka-ey.a.run.app/api/v1/dashboards/macro/pages/overview?country=XK"

The same page request from JavaScript with fetch():

const res = await fetch(
  "https://data4x-api-5jiit27kka-ey.a.run.app/api/v1/dashboards/" + slug + "/pages/" + pageId,
  { headers: { Authorization: "Bearer " + process.env.D4X_API_KEY } },
);
if (!res.ok) throw new Error("API " + res.status);
const { data } = await res.json();

Billing

Data reads are metered, and a full page costs more than a single widget. A page read (all widgets) deducts the api.page_read action; a single-widget read deducts the cheaper api.widget_read action. The dashboards listing and dashboard definition endpoints are free. No card on file is required for reads — they draw down your existing credits. When your balance is too low, the read returns 402 and no data is served.

Audit & security

Every API call is recorded in your workspace audit log. You can revoke a key at any time from the API keys page. Only the SHA-256 hash of each key is stored — the full secret is shown exactly once, at creation, and never again.

Errors

StatusMeaning
401Invalid or missing API key.
402Insufficient credits for a metered read.
403Workspace is not entitled to api.access.
404Dashboard, page or widget not found.

Machine-readable spec

Generate clients or import into your tooling from the OpenAPI 3 document:

https://data4x-api-5jiit27kka-ey.a.run.app/api/v1/openapi.json