Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to main content
Use the Macroscope REST API to read workspace data and update settings from scripts and pipelines. Each endpoint returns JSON. The REST API authenticates with workspace API keys. To let an AI assistant use the same operations by signing in as you, connect it to the MCP server. To run the Macroscope agent from an HTTP request, see Webhooks. API calls do not run agents and do not incur usage charges, with one exception: saving a Product Overview starts workspace onboarding, which uses credits.

Make your first request

Only workspace admins can create API keys, and the workspace needs an active subscription.

Create an API key

  1. Open Settings → API and select Create API key.
  2. Enter a Name and choose when the key expires under Expires after. The default is 90 days, and the maximum is one year.
  3. Under Access level, choose the level you need.
  4. Review the key’s access, then select Create key.
  5. Copy the key and save it securely before closing the dialog. The key is shown only once.

Send a request

Store the key in MACROSCOPE_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:
Settings → API shows a request for your workspace under Make your first request, with its workspace type and ID filled in. Copy and run it, or build the same request yourself from your workspace’s type and ID:
The response is your workspace. Check that you recognize 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.
Get workspace describes each field. From here, find the operation you need under Endpoints.

Authentication

Send your API key as a bearer token in the Authorization header of every request:
A key belongs to one workspace and can only address that workspace. It acts with its own access level, not its creator’s permissions. Do not put keys in URLs or query parameters. The REST API accepts only API keys. AI assistants can instead sign in as you with OAuth through the MCP server.

Base URL

Every endpoint path starts with your workspace:
ParameterValue
workspaceTypeGITHUB_ORGANIZATION or GITHUB_USER
workspaceIdThe numeric GitHub ID of the organization or user, as a string, for example "12345678"
Settings → API shows both values. You can also look up the ID with the GitHub CLI: 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 levelAdds
Read
  • Read workspace data, including repository settings, repository defaults, workspace settings, digest subscriptions and billing status
  • Detailed billing needs Admin access
Write
  • Change repository settings that require Write on the repository
  • Change the workspace’s Custom Agent Instructions and its Product Overview once it has one
  • Manage digest subscriptions
Admin
An Admin key can grant workspace Admin to any member of the GitHub organization. That person gets more access than the key has, including creating API keys and managing billing, and keeps it until the grant is removed, even after the key is revoked.
The key itself is not a workspace admin: creating API keys, managing billing and other administration the API does not offer still need a workspace admin. An Admin key can only request a contact change, which a workspace admin confirms in the app. New operations become available to existing keys at the operation’s level or higher. Some operations also need a workspace or repository permission; see Permissions and scope.

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:
OperationsRequires
Reports, areas, code review and Approvability, commits and billing statusRead key
List workspace reporting periodsRead key, plus Productivity when operation is CONTRIBUTOR_STATISTICS
Detailed billing: balance, controls, meter summaries, daily usage, agent credit usage and check-run agent billing summariesAdmin key
Contributor statistics, team statistics and coding time statisticsRead key and Productivity
List team membershipsRead key; Productivity not required
Get repository settings and Update repository settingsRead key and access to the repository to read; Write or Admin key to change, depending on the setting
Get repository defaults and Update repository defaultsRead key to read; Admin key to change
Get workspace settings and Update workspace settingsRead 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 subscriptionRead key to list, unless it excludes settings; Write key to change
Enable or disable a teamAdmin key
Log export, workspace contact and delegated adminsAdmin key, reads included
Without Productivity, reports omit productivity insights and commits omit estimates. Through the MCP server, an OAuth sign-in also needs your own permissions in the workspace: for example, enabling a team or reading detailed billing needs Admin access and you to be a workspace admin, and seeing secret teams you don’t belong to also needs both. Data coverage differs by endpoint:
  • 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: 25 means 25%, and rates such as addressedRate: 0.75 mean 75%.
  • Effort and coding time, such as engineeringOutputMinutes and 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 false and 0 are generally omitted. For repository settings, an explicit false means off; see Get repository settings. A missing optional field, such as a balance, means the value is unavailable, not zero. When historyUpdating or shippedNotReady is true, results are still being processed.

Pagination

Nine endpoints are paginated:
  1. Set pageSize from 1 to 200. The default is 50. Each endpoint page says what it counts, such as days for daily billing usage.
  2. Pass each response’s nextPageToken as pageToken in the next request, with the same filters and dates, including any you omitted. pageSize may change.
  3. Stop when nextPageToken is absent. A short or empty page can still have one.
Tokens are bound to the workspace, operation and filters, and are valid for up to 24 hours; they can become invalid sooner. If a token is rejected with 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, and RateLimit-Reset, the seconds until the budget resets. A successful request reports the workspace budget. A request a budget rejects fails with 429, reports that budget and includes Retry-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 429 without Retry-After; try again after a minute.
  • Response size: a response too large to return fails with 429 without Retry-After, with no partial results or continuation token. Narrow the request with a shorter date range, a smaller pageSize or narrower filters; retrying unchanged fails again. Team listings are not paginated or truncated, so they fail the same way.