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

# BugViper Analytics API — Dashboard and Repo Metrics

> REST endpoints for dashboard analytics and per-repo metrics. Query bugs caught, addressed rates, merge times, and daily review breakdowns.

Use the analytics endpoints to pull code review metrics into your own dashboards or reports. All three endpoints require a valid Firebase ID Token and return JSON. The dashboard endpoints aggregate data across every repo connected to your account, while the per-repo endpoint provides a granular daily breakdown for a single repository.

***

## GET /api/v1/repos/dashboard/analytics

Returns aggregated analytics across all repositories, including daily breakdowns of bugs caught and resolved per repo. Use this endpoint to power trend charts and cross-repo comparisons.

**Authentication required:** Yes

```bash theme={null}
curl https://your-domain.com/api/v1/repos/dashboard/analytics \
  -H "Authorization: Bearer <token>"
```

### Response

<ResponseField name="totalBugsCaught" type="integer">
  Total number of issues raised by BugViper across all repositories and all time.
</ResponseField>

<ResponseField name="totalResolved" type="integer">
  Total number of issues that have been marked as resolved or fixed across all repositories.
</ResponseField>

<ResponseField name="addressedRate" type="number">
  Percentage of raised issues that were subsequently addressed, expressed as a decimal between 0 and 1 (e.g., `0.72` for 72%).
</ResponseField>

<ResponseField name="prsPerWeek" type="number">
  Rolling average number of pull requests reviewed per week across all repos.
</ResponseField>

<ResponseField name="avgMergeTimeHours" type="number">
  Average time in hours from PR open to merge, calculated across all merged PRs.
</ResponseField>

<ResponseField name="dailyBreakdown" type="array">
  Array of per-repo daily activity objects. Each entry includes the repo identifier, a date string, a count of bugs caught on that date, and a count of issues resolved on that date.
</ResponseField>

***

## GET /api/v1/repos/dashboard/stats

Returns the summary statistics that populate the stat cards at the top of the BugViper dashboard. This is a lightweight endpoint designed for quick summary renders.

**Authentication required:** Yes

```bash theme={null}
curl https://your-domain.com/api/v1/repos/dashboard/stats \
  -H "Authorization: Bearer <token>"
```

### Response

<ResponseField name="reposCount" type="integer">
  Number of repositories currently connected to your BugViper account.
</ResponseField>

<ResponseField name="prsReviewed" type="integer">
  Total number of distinct pull requests that have received at least one BugViper review.
</ResponseField>

<ResponseField name="reviewsRun" type="integer">
  Total number of individual review runs executed across all repos and PRs.
</ResponseField>

<ResponseField name="bugsCaught" type="integer">
  Total number of issues raised by BugViper across all reviews.
</ResponseField>

<ResponseField name="addressedRate" type="number">
  Percentage of raised issues that were addressed, expressed as a decimal between 0 and 1.
</ResponseField>

<ResponseField name="prsPerWeek" type="number">
  Rolling average number of pull requests reviewed per week.
</ResponseField>

<ResponseField name="avgMergeTimeHours" type="number">
  Average time in hours from PR open to merge across all merged PRs.
</ResponseField>

***

## GET /api/v1/repos/\{owner}/\{repo}/analytics

Returns detailed analytics for a single repository, including a daily breakdown of bugs caught and resolved, addressed rate, average merge time, and PRs-per-week figures. Use this endpoint to render the per-repo analytics view.

**Authentication required:** Yes

### Path Parameters

<ParamField path="owner" type="string" required>
  GitHub organization name or username that owns the repository.
</ParamField>

<ParamField path="repo" type="string" required>
  Repository name.
</ParamField>

```bash theme={null}
curl https://your-domain.com/api/v1/repos/acme-org/my-repo/analytics \
  -H "Authorization: Bearer <token>"
```

### Response

<ResponseField name="totalIssues" type="integer">
  Total number of issues BugViper has raised across all PRs in this repository.
</ResponseField>

<ResponseField name="totalResolved" type="integer">
  Number of those issues that have been marked as resolved or fixed.
</ResponseField>

<ResponseField name="addressedRate" type="number">
  Percentage of raised issues that were addressed, expressed as a decimal between 0 and 1.
</ResponseField>

<ResponseField name="avgMergeTimeHours" type="number">
  Average time in hours from PR open to merge for this repository.
</ResponseField>

<ResponseField name="prsPerWeek" type="number">
  Rolling average number of pull requests reviewed per week in this repository.
</ResponseField>

<ResponseField name="dailyBreakdown" type="array">
  Array of daily activity objects covering the selected date range.

  <Expandable title="Daily breakdown object fields">
    <ResponseField name="date" type="string">
      Date in `YYYY-MM-DD` format.
    </ResponseField>

    <ResponseField name="caught" type="integer">
      Number of new issues raised by BugViper on this date.
    </ResponseField>

    <ResponseField name="resolved" type="integer">
      Number of previously open issues marked as resolved or fixed on this date.
    </ResponseField>
  </Expandable>
</ResponseField>
