Skip to main content

ReportsClient

The main client class for interacting with the Nebuly reports API.

Constructor

string
required
Your Nebuly public API key. Must not be a secret key (starting with sk-).
number
default:"0"
Number of retry attempts for failed requests.
number
default:"1000"
Delay in milliseconds between retry attempts.
string
default:"https://backend.nebuly.com/api/external"
Base URL for the Nebuly API.
boolean
default:"false"
Whether to suppress errors when a secret key is used instead of a public key.
boolean
default:"false"
Whether to suppress console error logs when a secret key is used.

Methods

listReports()

Retrieves a list of all available reports.
Report[]
Array of report objects containing basic report information.

getReport(params)

Retrieves detailed data for a specific report.
string
required
The unique identifier of the report to retrieve.
TimeRange
Optional time range filter for the report data.
Record<string, string | string[]>
Optional tags to filter the report data. Values can be strings or arrays of strings.
ReportData
The report data containing charts and metadata.

getChart(params)

Retrieves data for a single chart by ID.
string
required
The unique identifier of the chart to retrieve.
TimeRange
Optional time range filter for the chart data.
Record<string, string | string[]>
Optional tags to filter the chart data. Values can be strings or arrays of strings.
ChartData
The chart data object.

Types

Report

string
Unique identifier for the report.
string
Display name of the report.
string
Description of the report.

ReportData

string
Unique identifier for the report.
string
Display name of the report.
(ChartData)[]
Array of chart data objects within the report.

ChartData

string
Unique identifier for the chart (prefixed with “chart-”).
string
Display name of the chart.
string
Type of the chart.
string[]
Array of variable names used in the chart.
string
Type of visualization for the chart.
string
Display type for the chart.
string
Breakdown dimension for the chart data.
TimeRange
Time range for the chart data.
string
Time granularity for the chart data.
string[]
Array of x-axis label values.
DatasetDatapoint[]
Array of data points for the chart.

TimeRange

TimeRangeKind
The type of time range (e.g., “custom”, “today”, “7_days”, etc.).
string
Start date/time for the range (ISO format).
string
End date/time for the range (ISO format).

TimeRangeKind

Available time range kinds:
  • "custom" - Custom date range
  • "date_to_now" - From a specific date to now
  • "today" - Today only
  • "yesterday" - Yesterday only
  • "7_days" - Last 7 days
  • "30_days" - Last 30 days
  • "this_month" - Current month
  • "this_quarter" - Current quarter
  • "this_year" - Current year
  • "last_month" - Previous month
  • "last_quarter" - Previous quarter
  • "3_months" - Last 3 months
  • "6_months" - Last 6 months
  • "12_months" - Last 12 months
  • "3_months_full" - Last 3 full months
  • "6_months_full" - Last 6 full months
  • "12_months_full" - Last 12 full months
  • "q1" - Q1
  • "q2" - Q2
  • "q3" - Q3
  • "q4" - Q4
  • "ytd" - Year to date

DatasetDatapoint

string
Label for the data point.
Array<{x: number, y: number, user?: string}>
Array of coordinate data points with optional user information.

Error Handling

The client throws InvalidUrlError when an invalid base URL is provided during initialization.

Example Usage