Skip to main content

Getting Started with the Metrics API

This guide will help you quickly integrate the Bilanc Metrics API into your applications.

API Basics

All API requests should be made to the following base URL:
https://api.bilanc.co/metrics/v2/
All endpoints use HTTPS. HTTP requests will be redirected to HTTPS.
All API requests require authentication using PropelAuth. Include your authentication token in the request headers:
Authorization: Bearer YOUR_AUTH_TOKEN
See our Authentication guide for more details on obtaining and using access tokens.
API requests should be sent as HTTP POST requests with a JSON body containing the required parameters. The response will be in JSON format.
curl -X POST 'https://api.bilanc.co/metrics/v2/{metric_type}' \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": {
      "key1": "value1"
    },
    "group_by": ["field1"],
    "date_level": "month"
  }'

Example Requests

Here are some common examples to help you get started:
const axios = require('axios');

async function getMetrics() {
  try {
    const response = await axios.post('https://api.bilanc.co/metrics/v2/pull-requests-count', {
      filters: {
        repository_id: "123456"
      },
      group_by: ["repository_name"],
      date_level: "month",
      aggregation: "count",
      date_field: "created_at"
    }, {
      headers: {
        'Authorization': 'Bearer YOUR_AUTH_TOKEN',
        'Content-Type': 'application/json'
      }
    });
    
    console.log(response.data);
    return response.data;
  } catch (error) {
    console.error('Error fetching metrics:', error);
  }
}

Available Metrics

Bilanc provides a wide range of metrics across several categories: