Make your first request
Only workspace admins can create API keys, and the workspace needs an active subscription.Create an API key
- Open Settings → API and select Create API key.
- Enter a Name and choose when the key expires under Expires after. The default is 90 days, and the maximum is one year.
- Under Access level, choose the level you need.
- Review the key’s access, then select Create key.
- Copy the key and save it securely before closing the dialog. The key is shown only once.
Send a request
Store the key inMACROSCOPE_API_KEY, in your shell or your pipeline’s secret manager. This prompts for the key without echoing it or saving it in your shell history:
displayName as your GitHub organization or account, and that workspaceId matches the ID you sent. A 401 means the key was not sent or is not valid. For a 403, check the workspace type and ID in the path, then see Errors.
Authentication
Send your API key as a bearer token in theAuthorization header of every request:
Base URL
| Parameter | Value |
|---|---|
workspaceType | GITHUB_ORGANIZATION or GITHUB_USER |
workspaceId | The numeric GitHub ID of the organization or user, as a string, for example "12345678" |
gh api orgs/YOUR_ORG --jq .id, or gh api users/YOUR_LOGIN --jq .id for a personal account.
Access levels
Each key has one access level. Write includes Read. Admin includes Write.| Access level | Adds |
|---|---|
| Read |
|
| Write |
|
| Admin |
|
Manage keys
Manage keys under Settings → API.- Rotate creates a replacement key with the same access level. Rotation does not revoke the old key: it keeps working until you revoke it or it expires. Update your scripts to use the replacement, then revoke the old key.
- Revoke ends a key’s access on its next request. Revocation cannot be undone. Applications using it will lose access.
- To change a key’s access level, create a new key and revoke the old one.
Legacy read keys
Keys created before access levels were available have less access than current Read keys. Under Settings → API, a legacy key shows as Read with the detail: Workspace data, excluding repository settings, and it can’t read repository settings, repository defaults, workspace settings or digest subscriptions. Rotating it keeps that same access. To get full Read access, create a new Read key in Settings → API, and then revoke the old key.Endpoints
Paths are relative to/workspaces/{workspaceType}/{workspaceId}. Each endpoint page lists its parameters, response fields and permissions. The MCP Tools tables give the tool for each endpoint.
Workspace and reporting periods
Sprint reports and productivity
Code review and Approvability
Billing and usage
Repository settings and defaults
Workspace settings and teams
Workspace administration
Permissions and scope
Every endpoint requires workspace Read. The key’s access level decides which operations it can call, and some operations also need a workspace or repository permission:| Operations | Requires |
|---|---|
| Reports, areas, code review and Approvability, commits and billing status | Read key |
| List workspace reporting periods | Read key, plus Productivity when operation is CONTRIBUTOR_STATISTICS |
| Detailed billing: balance, controls, meter summaries, daily usage, agent credit usage and check-run agent billing summaries | Admin key |
| Contributor statistics, team statistics and coding time statistics | Read key and Productivity |
| List team memberships | Read key; Productivity not required |
| Get repository settings and Update repository settings | Read key and access to the repository to read; Write or Admin key to change, depending on the setting |
| Get repository defaults and Update repository defaults | Read key to read; Admin key to change |
| Get workspace settings and Update workspace settings | Read key to read; Write key to change Custom Agent Instructions or an existing Product Overview; Admin key to change the first Product Overview and every other setting |
| List digest subscriptions, Put digest subscription and Delete digest subscription | Read key to list, unless it excludes settings; Write key to change |
| Enable or disable a team | Admin key |
| Log export, workspace contact and delegated admins | Admin key, reads included |
- Code review statistics, code review comments and commits cover the repositories you select, and only those the key can access.
- Approvability statistics and runs match the Approvability page and include repositories that were removed or are no longer accessible.
- Reports and productivity statistics are workspace-wide and can include historical activity from repositories no longer accessible.
- Billing totals include excluded and deleted repositories and usage without a repository. Repository restrictions do not reduce them.
Conventions
- Dates are RFC 3339 timestamps, such as
2026-10-01T00:00:00Z. URL-encode offsets such as+05:30. Defaults, required dates and whether a bound is inclusive differ by endpoint; check the endpoint’s page. - Money and large integers are strings, such as
{"amount": "120.50", "currency": "USD"}and"commitCount": "42". - Percentages use two formats:
percentDelta: 25means 25%, and rates such asaddressedRate: 0.75mean 75%. - Effort and coding time, such as
engineeringOutputMinutesand coding time, are estimated person-minutes, not elapsed time. Sprint elapsed hours are different: they count working hours in a period. - Missing fields are not errors. Empty lists and default values such as
falseand0are generally omitted. For repository settings, an explicitfalsemeans off; see Get repository settings. A missing optional field, such as a balance, means the value is unavailable, not zero. WhenhistoryUpdatingorshippedNotReadyistrue, results are still being processed.
Pagination
Nine endpoints are paginated:- Workspace: List areas and List workspace reporting periods.
- Code review, Approvability and commits: List code review comments, List approvability runs and List commits.
- Billing: List billing meter summaries, List daily billing usage, List agent credit usage and List check-run agent billing summaries.
- Set
pageSizefrom 1 to 200. The default is 50. Each endpoint page says what it counts, such as days for daily billing usage. - Pass each response’s
nextPageTokenaspageTokenin the next request, with the same filters and dates, including any you omitted.pageSizemay change. - Stop when
nextPageTokenis absent. A short or empty page can still have one.
400, start again without it. Results are live, not a consistent snapshot, unless the endpoint page says otherwise.
Errors
Errors return an HTTP status and a JSON body:
Endpoint pages list the cases specific to them, such as Approvability being unavailable for a workspace or too many log export configuration attempts.
Responses that reach the API include an
X-Request-ID header. Include it when you contact support@macroscope.com about a failed request.
Limits
- Timeout: requests time out after 55 seconds.
- Rate limits apply per key and per workspace. When the quota check runs, the response includes
RateLimit-Limit, the requests the budget allows,RateLimit-Remaining, the requests left, andRateLimit-Reset, the seconds until the budget resets. A successful request reports the workspace budget. A request a budget rejects fails with429, reports that budget and includesRetry-After, the seconds to wait before retrying. Some rejected requests, such as authentication failures, may not include these headers. - Operation limits: Configure log export allows 5 configuration attempts per workspace per minute. Further attempts fail with
429withoutRetry-After; try again after a minute. - Response size: a response too large to return fails with
429withoutRetry-After, with no partial results or continuation token. Narrow the request with a shorter date range, a smallerpageSizeor narrower filters; retrying unchanged fails again. Team listings are not paginated or truncated, so they fail the same way.