API / get-bugbot-analytics-via-analytics-api

API

Get Bugbot PR analytics with the Analytics API

Pull per-PR Bugbot review analytics with GET https://api.cursor.com/analytics/team/bugbot. Official reference: Analytics API → Bugbot Analytics.

Authenticate with Basic auth (API key as username, empty password). Create keys at Cursor Dashboard → API Keys. Most Analytics endpoints need scope admin:*. Availability: Enterprise only. Team-level rate limit: 100 requests per minute per team.

Each row covers one pull request: review count, issue totals by severity, and how many issues were resolved. For per-review billed cost and individual findings, use Get Bugbot review analytics.

Query parameters

Parameter Rules
startDate Optional. Default: 7 days ago. Prefer YYYY-MM-DD, or shortcuts now / today / yesterday / Nd. Max range 30 days. Time is ignored (day-level UTC).
endDate Optional. Default: today. Same formats as startDate.
prState Optional. merged (default) or all.
repo Optional. Full URLs or host/path (e.g. https://github.com/org/repo.git or github.com/org/repo). Normalized to host/owner/repo.
page Optional. 1-indexed. Default: 1.
pageSize Optional. PRs per page. Default: 100, max: 250.

Omit both dates for the last 7 days (simplest path for HTTP caching). Prefer day shortcuts or YYYY-MM-DD over ISO timestamps so ETag cache hits stay stable.

Request

curl -X GET "https://api.cursor.com/analytics/team/bugbot" \
  -u YOUR_API_KEY:

Filter by repository and date range:

curl -X GET "https://api.cursor.com/analytics/team/bugbot?repo=github.com/acme/app&startDate=2025-01-01&endDate=2025-01-31" \
  -u YOUR_API_KEY:

Paginate:

curl -X GET "https://api.cursor.com/analytics/team/bugbot?page=2&pageSize=50" \
  -u YOUR_API_KEY:

Example response:

{
  "data": [
    {
      "repo": "github.com/acme/app",
      "pr_number": 42,
      "timestamp": "2025-01-21T00:00:00.000Z",
      "reviews": 3,
      "issues": {
        "total": 5,
        "by_severity": {
          "high": 1,
          "medium": 2,
          "low": 2
        }
      },
      "issues_resolved": {
        "total": 2,
        "by_severity": {
          "high": 1,
          "medium": 1,
          "low": 0
        }
      }
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 100,
    "totalItems": 1,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false
  },
  "params": {
    "metric": "bugbot",
    "teamId": 12345,
    "startDate": "2025-01-01",
    "endDate": "2025-01-31",
    "repo": "github.com/acme/app",
    "prState": "merged",
    "page": 1,
    "pageSize": 100
  }
}

Response fields

Field Type Meaning
repo string Normalized host/owner/repo
pr_number number Pull request number
timestamp string PR / analytics timestamp (ISO)
reviews number Bugbot reviews on that PR
issues.total number Findings counted
issues.by_severity object Counts for high / medium / low
issues_resolved.total number Resolved findings
issues_resolved.by_severity object Resolved counts by severity
pagination.* object page, pageSize, totalItems, totalPages, hasNextPage, hasPreviousPage
params.metric string Echoes bugbot
params.prState string Resolved merged or all

Caching

Store the response ETag and send it back as If-None-Match on the next poll. Unchanged data returns 304 Not Modified with no body; 304s do not count against the rate limit. Analytics endpoints use Cache-Control: public, max-age=900 (15 minutes). See API Overview → Caching.

Pitfalls

  • Leaving prState unset when you need open PRs — default is merged only.
  • Passing an unnormalized repo string and expecting an exact match failure — the API normalizes to host/owner/repo.
  • Requesting more than 30 days — the Analytics date range caps at 30 days.
  • Polling without If-None-Match — burns the 100/min team budget on identical payloads.
  • Expecting billed cost or per-finding bodies here — those live on /analytics/team/bugbot-reviews.

Sibling how-tos in this batch: Get the team leaderboard, Get Bugbot review analytics, Get by-user metrics.