In a data-driven world, Key Performance Indicators (KPIs) are the compass that guides business strategy. Yet, for many organizations, tracking them is a frustratingly manual process. It involves static spreadsheets, disconnected dashboards, and a constant cycle of exporting, crunching, and presenting data. This latency means you're often looking in the rearview mirror, making decisions on outdated information.
What if you could treat your business metrics with the same rigor, agility, and automation as your application code?
This is the core philosophy behind KPIs.do: KPIs as Code. Performance as a Service. We believe that by defining, tracking, and automating your performance indicators programmatically, you can transform them from static reports into dynamic, living services. The engine that powers this transformation is our API.
This post will dive deep into the KPIs.do API, explaining how you can turn complex business metrics into simple, actionable, and programmable services.
Before we explore the API endpoints, let's unpack the "KPIs as Code" concept. It means defining your most critical business logic—your metric calculations, targets, and thresholds—in version-controlled configuration files.
Think about the benefits this unlocks:
The KPIs.do platform and its API are built to bring this powerful concept to life, moving your metrics from a siloed spreadsheet into your active development workflow.
Our API-first design ensures that every piece of data and functionality is accessible programmatically. You can push data to us, pull calculated values, and integrate our automated alerts into any tool in your stack.
Let's look at the core functions.
The most fundamental interaction with the platform is sending it data. You don't need to set up complex ETL pipelines; you can simply push data points directly from your applications and services as events happen.
Our SDK makes this incredibly simple. Here’s how you would track your monthly sales growth:
import { kpis } from 'kpis.do';
// Track a new data point for a pre-defined KPI
const result = await kpis.track({
name: 'monthly-sales-growth',
value: 12.5, // Current month's growth percentage
dimensions: {
region: 'North America',
product: 'Enterprise Plan'
}
});
// Check the status and any triggered alerts
console.log(result.status); // 'tracked'
console.log(result.alerts); // [{...}] if any thresholds were crossed
Let's break this down:
Pushing data is only half the story. The real value is getting actionable insights out. The KPIs.do API allows you to query the current state of any KPI, which you can then use to power internal dashboards, custom reports, or even display in your product's UI.
For example, a request to fetch the status of our sales KPI might look like this:
GET /api/v1/kpis/monthly-sales-growth
And the response would provide a rich object containing the current value, historical trend, and whether it's on target—turning performance tracking into a simple, consumable data service.
This is where KPIs.do evolves from a tracking tool into an agentic workflow platform. In your KPI definition, you can set thresholds for what is considered 'good', 'at-risk', or 'critical'. When an incoming data point from the track API call crosses one of these thresholds, our platform automatically triggers an alert.
As you see in the code example, the result.alerts array will contain these triggers.
But it doesn't stop there. These alerts can be configured to send webhooks to any destination. This connects your business performance directly to your operational tools:
This closes the loop between insight and action, enabling continuous performance improvement with zero manual intervention.
The possibilities of a performance tracking API are endless. Here are a few examples:
Moving beyond static dashboards is a critical step in building a truly responsive and data-driven organization. The KPIs.do API provides the programmatic foundation to make that happen.
Ready to turn your metrics into services? Explore KPIs.do and start building your agentic performance workflows today.