Get an API key
Analytics API access requires a Pro or Max plan.
1
Get a key
For your personal key, click Generate API key under Personal API key. Personal keys
start with
cbk_. If you already use one with the cubic CLI or MCP server, use the same key,
because regenerating it replaces the key for every tool.For an organization key, an organization admin clicks Create API key under
Organization API keys. Organization keys start with cok_, and both Read and Admin
access work.2
Store it securely
cubic only shows the full value once. Save the key in your secret manager or local environment.
If you revoke or regenerate the key, the previous value stops working immediately.
cak_ keep working, but cubic no longer creates them. Move your
tools to a personal or organization key, then revoke the cak_ key on the
cubic API page.
A personal key reads only the organizations and repositories you can already access in cubic. An
organization key reads only its own organization.
Endpoint
Use this endpoint to fetch merged pull requests that have completed cubic reviews in the selected time window.Analytics responses may reflect normal read-replica lag. Recent reviews, pull request updates, and
custom-rule changes can take a short time to appear, so do not use these responses for immediate
read-after-write verification.
Authentication
Send a personal or organization key in theAuthorization header as a bearer token.
429 with a
Retry-After header in seconds.
The interactive reference includes all query
parameters, response schemas, and code examples. Enter your API key to try a request.
You can also use the OpenAPI spec to generate a client.
Example requests
Query parameters
See the endpoint reference for the full parameter list.org is required. Use repo to filter to one repository and perPage to choose a page size
from 1 to 100. Values outside that range return 400.
String query values are trimmed before validation; blank optional values are ignored.
The date window selects completed cubic reviews created in that period. The returned pull
requests must be merged, but their merge dates can fall outside the selected review window.
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.totalAiLinesAuthored is capped at the pull request’s total added and deleted
lines; it is 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.
Errors
Analytics errors include anerror message and may include validation details. Check the HTTP
status and display the message when a request fails. See the
endpoint reference for error statuses and response
schemas.