Get an API key
Open the Analytics API integration
Generate a personal key
Click Generate API key. Analytics API keys start with
cak_, and cubic only shows the full value once.API keys are personal. Each team member should generate their own key, and every request is limited to the organizations and repositories that key owner can already access in cubic.
Endpoint
Use this endpoint to fetch merged pull requests that have completed cubic reviews in the selected time window.| Method | Endpoint |
|---|---|
GET | https://www.cubic.dev/api/analytics/v1/prs |
Authentication
Send the Analytics API key in theAuthorization header as a bearer token.
Example requests
Query parameters
| Parameter | Required | Description |
|---|---|---|
org | Yes | GitHub organization or owner whose pull request analytics you want to fetch. |
repo | No | Limit the request to a single repository inside the selected owner. |
startDate | No | Start of the time window. Supports ISO 8601 timestamps and date-only values like 2026-04-01. |
endDate | No | End of the time window. Supports ISO 8601 timestamps and date-only values like 2026-04-30. |
perPage | No | Number of results per page. Defaults to 100 and is capped at 100. |
cursor | No | Cursor from the previous response. Use it to fetch the next page. |
If you do not send
startDate or endDate, cubic picks a default window based on how much data is available for that installation: the last 30 days, last 7 days, or last 24 hours.Date-only values are interpreted in UTC. For example,
endDate=2026-04-30 includes the full day through 23:59:59.999Z.startDateonly:endDatedefaults to the current timeendDateonly:startDatedefaults to the start of available data
Response format
The API returns one page of PR rows plus an optional cursor for the next page.Top-level fields
| Field | Description |
|---|---|
data | The current page of pull request analytics rows. |
nextCursor | Cursor for the next page, or null when there are no more results. |
Pull request row fields
| Field | Description |
|---|---|
org | GitHub owner used for the request. |
repo | Repository name. |
prNumber | Pull request number. |
author | GitHub login of the pull request author. |
createdAt | Pull request creation timestamp in ISO 8601 format. |
mergedAt | Pull request merge timestamp in ISO 8601 format. |
linesAdded | Lines added in the pull request, or null when unavailable. |
linesDeleted | Lines deleted in the pull request, or null when unavailable. |
numberOfCubicIssuesFlagged | Number of cubic issues flagged on the pull request. |
numberOfCubicIssuesFixed | Number of cubic issues fixed on the pull request. |
cubicFirstReviewedAt | Timestamp of the first completed cubic review for the pull request. |
totalAiLinesAuthored | Total AI-authored lines attributed to the pull request, or null when no AI authorship data is available. |
Pagination
WhennextCursor is present, send it back in the next request to continue from the previous page.
Common errors
| Status | When it happens |
|---|---|
400 | Missing org, invalid query parameters, invalid cursor, or invalid date range. |
401 | Missing bearer token, invalid API key, or expired API key. |
403 | The API key owner does not have access to the requested organization or repository. |
404 | cubic cannot resolve the org to an installation. |