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

# Query code review statistics

> Review counts, summary rates, and a ten-week feedback trend for selected repositories.

Returns code review counts and rates for a time range, plus a ten-week feedback trend. Every selected repository must be readable by the caller.

## Authorization

Requires workspace Read and read access to the selected repositories. This fixed ten-week trend has no pagination. Results are live, not a completeness guarantee; zero counts can mean no matching recorded data rather than all activity having been processed. Summary rates default to zero when there is no denominator, while optional weekly rates are omitted.

**Authorization** `string` *required*

`Bearer <key>`. See [Authentication](https://docs.macroscope.com/api#authentication).

## Path parameters

**workspaceType** `string` *required*

`GITHUB_ORGANIZATION` or `GITHUB_USER`.

**workspaceId** `string` *required*

Numeric GitHub ID of the organization or user.

## Query parameters

Repeat a parameter to pass multiple values, e.g. `repositoryIds=1&repositoryIds=2`. Omit a list parameter to apply no filter.

**startTime** `string` *required*

Inclusive start (RFC 3339).

**endTime** `string` *required*

Inclusive end (RFC 3339). Must not be before `startTime`, and the range can be at most 366 days.

**repositoryIds** `string[]`

Up to 100 distinct repository IDs. Omit for all readable active repositories, which must also number 100 or fewer. Inactive or deleted repositories contribute nothing.

**authorIds** `string[]`

Up to 100 GitHub user IDs of pull request authors.

**reviewTypes** `string[]`

`CORRECTNESS`, `IDIOM`, `TICKET_REQUIREMENTS`, or `CUSTOM`. Does not apply to `feedbackTrend`.

**prStatuses** `string[]`

`OPEN`, `OPEN_DRAFT`, `CLOSED_MERGED`, or `CLOSED_NOT_MERGED`. Matches the pull request's current state. Does not apply to `feedbackTrend`.

**reactions** `string[]`

`POSITIVE` or `NEGATIVE`. Filters review comments only, not reviewed pull request counts or `feedbackTrend`.

**addressedOnly** `boolean`

`true` for addressed comments, `false` for unaddressed comments. Omit for both.

**feedbackSources** `string[]`

`REACTION` (thumbs up or down) or `CLASSIFIER` (inferred from human replies). With one source selected, `reviewedPullRequests` counts distinct pull requests with matching comments.

**customCheckNames** `string[]`

Exact custom agent names, up to 100 of at most 256 characters each. Excludes standard reviews from `reviewedPullRequests`. Does not apply to `feedbackTrend`.

**searchQuery** `string`

Case-insensitive substring match on comment text, up to 256 characters. Does not apply to `reviewedPullRequests`.

## Response

**reviewedPullRequests** `string`

Reviewed pull requests (int64 as string). Standard reviews plus custom agent reviews, so one pull request can count twice.

**postedReviewComments** `string`

Review comments posted (int64 as string).

**addressedRate** `number`

Addressed comments / posted comments, 0 to 1. Zero when there are no comments.

**disapprovalRate** `number`

Negative comments / posted comments over the last 30 days of the range, 0 to 1.

**averageIssuesPerPullRequest** `number`

Posted comments / reviewed pull requests. Zero when there are no reviewed pull requests.

**feedbackTrend** `object[]`

Ten Monday-start UTC weeks ending with the week containing `endTime`, oldest first. Counts only correctness comments on merged pull requests.

**properties**

**weekStart** `string`

Monday 00:00 UTC that starts the week (RFC 3339).

**addressedRate** `number`

Addressed comments / comments, 0 to 1.

**positiveRate** `number`

Comments with a thumbs up or addressed / comments, 0 to 1.

**negativeRate** `number`

Negative comments / comments, 0 to 1.

**approvalRate** `number`

Thumbs up / (thumbs up + thumbs down), 0 to 1.

**thumbsUpCount** `string`

Thumbs up reactions (int64 as string).

**thumbsDownCount** `string`

Negative comments (int64 as string).

Weekly rates are rounded to four decimals and omitted when there is no denominator, including weeks before `startTime`. An omitted rate means no data, not zero. Results reflect current feedback and pull request state, so past ranges can change.

```bash cURL theme={null}
curl --get https://api.macroscope.com/api/v1/workspaces/GITHUB_ORGANIZATION/12345678/code-review-statistics \
  -H "Authorization: Bearer $MACROSCOPE_API_KEY" \
  --data-urlencode "startTime=2026-09-01T00:00:00Z" \
  --data-urlencode "endTime=2026-09-30T23:59:59Z" \
  --data-urlencode "reviewTypes=CORRECTNESS"
```

```python Python theme={null}
import os, requests

r = requests.get(
    "https://api.macroscope.com/api/v1/workspaces/GITHUB_ORGANIZATION/12345678/code-review-statistics",
    headers={"Authorization": f"Bearer {os.environ['MACROSCOPE_API_KEY']}"},
    params={
        "startTime": "2026-09-01T00:00:00Z",
        "endTime": "2026-09-30T23:59:59Z",
        "reviewTypes": ["CORRECTNESS"],
    },
)
print(r.json())
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({
  startTime: "2026-09-01T00:00:00Z",
  endTime: "2026-09-30T23:59:59Z",
});
params.append("reviewTypes", "CORRECTNESS");
const res = await fetch(
  `https://api.macroscope.com/api/v1/workspaces/GITHUB_ORGANIZATION/12345678/code-review-statistics?${params}`,
  { headers: { Authorization: `Bearer ${process.env.MACROSCOPE_API_KEY}` } }
);
console.log(await res.json());
```

```json 200 theme={null}
{
  "reviewedPullRequests": "120",
  "postedReviewComments": "240",
  "addressedRate": 0.5,
  "disapprovalRate": 0.05,
  "averageIssuesPerPullRequest": 2,
  "feedbackTrend": [
    {
      "weekStart": "2026-07-27T00:00:00Z"
    },
    {
      "weekStart": "2026-09-28T00:00:00Z",
      "addressedRate": 0.5,
      "positiveRate": 0.6,
      "negativeRate": 0.05,
      "approvalRate": 0.9,
      "thumbsUpCount": "9",
      "thumbsDownCount": "1"
    }
  ]
}
```

```json 401 theme={null}
{ "code": 16, "message": "unauthenticated" }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.