Skip to main content
Updates the defaults named in updateMask. Repositories added to the workspace afterwards start with the new values. Repositories already in the workspace keep their settings; change those one repository at a time with Update repository settings. If any default is invalid or you lack permission to change it, the whole update fails. A repository copies every default once, when it is added. Later changes to the defaults do not reach it. If the Policy Repo default is no longer in the workspace when a repository is added, that repository starts with no Policy Repo.
Changes take effect immediately for repositories added afterwards and are recorded in the workspace audit log.
Read the current defaults before updating. If someone saves the defaults in the meantime, including in the Macroscope app, the update returns 409 Conflict and changes nothing. Read them again, check that your change still applies, and retry with the new version. A successful update also advances the version, so resending one whose response you lost returns 409; read the defaults to see whether it applied.

Permissions

Use an Admin key for the workspace. Every Admin key can change defaults, including keys created before this endpoint existed. Read and Write keys can read defaults but cannot change them. With OAuth sign-in, the client needs Admin access and you must be a Macroscope workspace admin. A client with Read or Write access receives an insufficient_scope challenge for macroscope:admin. Connections already approved at Admin need no new approval. An Admin key can change repository defaults and repository settings, and use the workspace administration operations listed under Endpoints, including granting or removing workspace Admin. The key itself is not a workspace admin: it cannot manage billing or API keys. Check editableFields in the Get repository defaults response to see which defaults you can change. With OAuth sign-in, the list is empty unless the client has Admin access and you are a workspace admin. Defaults for features the workspace does not have, such as Approvability, cannot be changed. To set a Policy Repo, you also need read access to the source repository in the same workspace.

Authorization

string
required
Bearer <key>. See Authentication.
string
How your client identifies the source of the request in the workspace audit log. Use human or agent. Macroscope records the client’s value without verifying it. Other values are treated as unspecified.

Path parameters

string
required
GITHUB_ORGANIZATION or GITHUB_USER.
string
required
Numeric GitHub ID of the organization or user.

Body

Send a JSON body of up to 256 KiB. A larger body returns 413.
string
required
Version returned by Get repository defaults, as a decimal string.
string
required
Comma-separated names of the defaults to change, as they appear in settings, for example "prSummaryEnabled,skipPrLabels". Between 1 and 26 names, each at most once.
WorkspaceRepoDefaultValues
New values for the fields in updateMask. To clear correctnessMaxRunsPerPr, correctnessMaxFileSizeBytes, policyRepoId, releaseRefPatterns, skipPrAuthorLogins, skipPrLabels, skipPrTargetBranches, or alwaysReviewPrLabels, name it in the mask and omit its value. All other named fields need a value. The two Correctness limits must be at least 1 when set. A filter list replaces the whole list. Clearing it, or sending {}, leaves it empty so that no pull requests match it. A detection mode that is not among the workspace’s choices in the Macroscope app is refused with 400. See WorkspaceRepoDefaultValues for field values.

Response

WorkspaceRepoDefaults
The workspace’s repository defaults and version after the update, in the same form as Get repository defaults.

Audit log

Each successful change is recorded in the workspace audit log with the API key or the signed-in person and connected app, the client’s User-Agent, and any reported X-Macroscope-Initiation. Denied and stale updates can also appear there. Requests rejected before admission, such as malformed requests, invalid credentials, workspace mismatches, and rate-limited requests, may have no audit entry.

Errors

HTTPMeaning
400Invalid body: an unknown or repeated name in updateMask, a value without its name, a cleared default that cannot be cleared, a value out of range, or a detection mode the workspace does not offer
403Your credential cannot change defaults, you cannot read the Policy Repo you named, or the feature a named default belongs to is unavailable
404The workspace has no repository defaults
409The defaults changed after version was read. Nothing was changed
413Body larger than 256 KiB
These examples make new repositories skip pull requests labeled no-review. The response shows selected defaults.