> ## 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.

# Development Metrics

> API endpoints for development time and process metrics

## Development Metrics

Development metrics focus on the time spent in different phases of the development process, helping teams understand and optimize their development workflow.

### Available Metrics

<ParamField path="coding-time" type="string">
  Time spent coding (from first commit to PR open)
</ParamField>

<ParamField path="pickup-time" type="string">
  Time between PR open and first review
</ParamField>

<ParamField path="commit-to-open" type="string">
  Time from first commit to PR open
</ParamField>

<ParamField path="open-to-review" type="string">
  Time between PR open and first review
</ParamField>

<ParamField path="review-to-merge" type="string">
  Time between first review and merge
</ParamField>

<ParamField path="review-time" type="string">
  Total time spent in the review phase
</ParamField>

<ParamField path="rework-time" type="string">
  Time spent on rework after a review
</ParamField>

<ParamField path="cycle-time" type="string">
  Full cycle time from first commit to merge
</ParamField>

<ParamField path="time-to-first-comment" type="string">
  Time from PR open to the first comment
</ParamField>

<ParamField path="rework-rate" type="string">
  Percentage of PRs that required rework after review
</ParamField>

## Cycle Time Metric

This example demonstrates how to retrieve the cycle time metric, which measures the full development cycle from initial commit to merge.

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST 'https://api.bilanc.co/metrics/cycle-time' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "filters": {
        "repositories": [{"repository_name": "repo-name-1"}, {"repository_name": "repo-name-2"}],
        "start_date": "2023-01-01",
        "end_date": "2023-02-28"
      },
      "group_by": ["repository_name", "name"],
      "date_level": "month",
      "aggregation": "AVG",
      "date_field": "merged_at"
    }'
  ```

  ```json Response theme={null}
  [
    {
      "month_date": "2023-01-01",
      "name": "John Doe",
      "repository_name": "repo-name-1",
      "avg_cycle_time": 1500
    },
    {
      "month_date": "2023-01-01",
      "name": "John Doe",
      "repository_name": "repo-name-2",
      "avg_cycle_time": 1300
    },
    {
      "month_date": "2023-01-01",
      "name": "Jane Doe",
      "repository_name": "repo-name-1",
      "avg_cycle_time": 1110
    },
    {
      "month_date": "2023-02-01",
      "name": "Jane Doe",
      "repository_name": "repo-name-1",
      "avg_cycle_time": 1710
    }
  ]
  ```
</CodeGroup>

## Review Time Metric

This example demonstrates how to retrieve the review time metric, which measures the total time spent in the review phase.

<CodeGroup>
  ```bash Request theme={null}
  curl -X POST 'https://api.bilanc.co/metrics/review-time' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "filters": {
        "team": ["team123"],
        "start_date": "2023-01-01",
        "end_date": "2023-02-28"
      },
      "group_by": ["team_name"],
      "date_level": "month",
      "aggregation": "AVG",
      "date_field": "merged_at"
    }'
  ```

  ```json Response theme={null}
  [
    {
      "month_date": "2023-01-01",
      "team_name": "Frontend",
      "avg_review_time": 500
    },
    {
      "month_date": "2023-01-01",
      "team_name": "Backend",
      "avg_review_time": 800
    },
    {
      "month_date": "2023-02-01",
      "team_name": "Frontend",
      "avg_review_time": 100
    },
    {
      "month_date": "2023-02-01",
      "team_name": "Backend",
      "avg_review_time": 900
    },
  ]
  ```
</CodeGroup>

## Parameter Notes

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

  * `created_at`: When the PR was created
  * `merged_at`: When the PR was merged (recommended for cycle time)
  * `first_review_at`: When the PR received its first review
</ResponseField>

<ResponseField name="aggregation" type="string">
  Required for all development time metrics. Accepted values: `SUM`, `MAX`, `MIN`, `AVG`.
</ResponseField>

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

  * `repositories`: Array of `{"repository_name": "..."}` objects
  * `member`: Filter by author merged user 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
  * `sources`: VCS source — `github`, `gitlab`, `bitbucket`
  * `pr_states`: PR states — `open`, `closed`, `merged`
  * `pr_categories`: PR category classifications
  * `pr_ids`: Filter by specific PR IDs
  * `pull_requests_search_term`: Full-text search across PR fields
  * `locations`: Filter by employee location
  * `levels`: Filter by employee level
</ResponseField>

## Common Use Cases

* **Track Cycle Time Trends**: Monitor how development cycle time changes over time
* **Identify Bottlenecks**: Find which part of the development process takes the longest
* **Compare Team Performance**: Compare cycle times across different teams or repositories
* **Set Performance Goals**: Establish baseline metrics and set improvement goals
