> ## Documentation Index
> Fetch the complete documentation index at: https://bilanc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue Metrics

> API endpoints for issue and ticket related metrics

## Issue Metrics

Issue metrics provide insights into ticket management, story points, and team productivity in handling issues.

### Available Metrics

<ParamField path="issues-count" type="string">
  Number of issues
</ParamField>

<ParamField path="completed-issues-count" type="string">
  Number of completed issues
</ParamField>

<ParamField path="started-issues-count" type="string">
  Number of started issues
</ParamField>

<ParamField path="backlog-issues-count" type="string">
  Number of backlog issues
</ParamField>

<ParamField path="story-points" type="string">
  Story points
</ParamField>

<ParamField path="completed-story-points" type="string">
  Completed story points
</ParamField>

<ParamField path="started-story-points" type="string">
  Started story points
</ParamField>

<ParamField path="issue-cycle-time" type="string">
  Issue cycle time
</ParamField>

<ParamField path="issue-comment-interactions-count" type="string">
  Issue comment interaction count
</ParamField>

<ParamField path="issue-comments-count" type="string">
  Number of issue comments
</ParamField>

## Completed Issues Count Metric

This endpoint provides the count of completed issues based on specified filters.

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST 'https://api.bilanc.co/metrics/completed-issues-count' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "filters": {
        "team": ["team123"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "group_by": ["team_name", "name"],
      "date_level": "month",
      "date_field": "completed_at",
      "time_series_data": true
    }'
  ```

  ```json Response theme={null}
  {
    "series": [
      {
        "name": "Backend Team/Alice",
        "data": [12, 15, 10, 18, 14, 16]
      },
      {
        "name": "Backend Team/Bob",
        "data": [8, 12, 11, 9, 13, 15]
      },
      {
        "name": "Frontend Team/Charlie",
        "data": [10, 9, 14, 12, 15, 17]
      }
    ],
    "categories": ["Jan 2023", "Feb 2023", "Mar 2023", "Apr 2023", "May 2023", "Jun 2023"],
    "meta": {
      "filters": {
        "team": ["team123"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "date_range": {
        "start_date": "2023-01-01",
        "end_date": "2023-06-30"
      }
    }
  }
  ```
</CodeGroup>

## Story Points Metric

This endpoint provides information about story points.

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST 'https://api.bilanc.co/metrics/story-points' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "filters": {
        "team": ["team123"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "group_by": ["team_name"],
      "date_level": "quarter",
      "aggregation": "SUM",
      "date_field": "created_at"
    }'
  ```

  ```json Response theme={null}
  {
    "results": [
      {
        "metric_name": "story-points",
        "value": 320,
        "group_by": {
          "team_name": "Backend Team"
        }
      },
      {
        "metric_name": "story-points",
        "value": 285,
        "group_by": {
          "team_name": "Frontend Team"
        }
      },
      {
        "metric_name": "story-points",
        "value": 175,
        "group_by": {
          "team_name": "QA Team"
        }
      }
    ],
    "meta": {
      "filters": {
        "team": ["team123"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "date_range": {
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      }
    }
  }
  ```
</CodeGroup>

## Issue Cycle Time Metric

This endpoint provides data on issue cycle time (from creation to completion).

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST 'https://api.bilanc.co/metrics/issue-cycle-time' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "filters": {
        "project_ids": ["project456"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "group_by": ["issue_type"],
      "date_level": "month",
      "aggregation": "AVG",
      "date_field": "completed_at",
      "time_series_data": true
    }'
  ```

  ```json Response theme={null}
  {
    "series": [
      {
        "name": "Bug",
        "data": [4.2, 3.8, 3.5, 3.1, 2.8, 2.5]
      },
      {
        "name": "Feature",
        "data": [10.5, 9.8, 10.2, 8.7, 7.9, 7.2]
      },
      {
        "name": "Task",
        "data": [2.1, 1.9, 1.7, 1.5, 1.4, 1.2]
      }
    ],
    "categories": ["Jan 2023", "Feb 2023", "Mar 2023", "Apr 2023", "May 2023", "Jun 2023"],
    "meta": {
      "filters": {
        "project_ids": ["project456"],
        "start_date": "2023-01-01",
        "end_date": "2023-12-31"
      },
      "date_range": {
        "start_date": "2023-01-01",
        "end_date": "2023-06-30"
      },
      "unit": "days"
    }
  }
  ```
</CodeGroup>

## Parameter Notes

<ResponseField name="date_field" type="string">
  For issue metrics, the following date fields are available:

  * `created_at`: When the issue was created
  * `started_at`: When work on the issue started
  * `completed_at`: When the issue was completed
  * `closed_at`: When the issue was closed
</ResponseField>

<ResponseField name="aggregation" type="string">
  Required for story point and cycle time metrics. Accepted values: `SUM`, `MAX`, `MIN`, `AVG`.
  Count-based metrics (`issues-count`, `completed-issues-count`, `started-issues-count`, `backlog-issues-count`, `issue-comment-interactions-count`, `issue-comments-count`) do not require an aggregation.
</ResponseField>

<ResponseField name="filters" type="object">
  Applicable filters for issue metrics:

  * `ticket_status`: Filter by issue state — `completed`, `started`, `backlog`, etc.
  * `issue_ids`: Filter by specific issue IDs
  * `project_ids`: Filter by project IDs
  * `team`: Filter by team IDs
  * `squad_ids`: Filter by squad IDs
  * `squad_levels`: Filter by squad hierarchy level
  * `manager_ids`: Filter by manager user IDs
  * `departments`: Filter by department names
  * `member`: Filter by assignee/author merged user IDs
  * `locations`: Filter by employee location
  * `levels`: Filter by employee level
</ResponseField>

## Common Use Cases

* **Sprint Velocity**: Track completed story points per sprint
* **Ticket Resolution**: Monitor the number of completed issues over time
* **Cycle Time Analysis**: Identify bottlenecks in issue resolution
* **Backlog Management**: Track the growth or reduction of backlog issues
* **Comment Analysis**: Analyze communication patterns through issue comments
* **Team Performance**: Compare team productivity based on issues completed and story points
