Codediffs
GET/repositories/{repo_id}/diff-files
List every file a diff between two commits changes, without patches
get_diff_files
diff:read
A token needs thediff:readscope: View commit, merge-request, and branch-comparison diffsGranted bymcp_agent,mcp_agent_write,read_api,read_repository,write_api,write_repository.Every operation this scope unlocksMetered egress · in band body
x-gitmoap-egress: {"kind":"metered","arg":"in_band_body"}
Cacheable · immutable SHA
x-gitmoap-cache: {"kind":"immutable_sha"}
Each changed file's path, previous path, status, line counts and whether it is binary or generated, in path order and in one answer, with totals for the whole change. Up to 20,000 files are listed; past that the list says it is truncated. Addressed by two full commit SHAs.
Parameters
Path
- repo_idRepositoryId (string · uuid)Repository ID
Query
- basestringBase commit SHA — a diff's base_sha. Required.
- headstringHead commit SHA — a diff's head_sha. Required.
Responses
200Every changed file, in path orderapplication/json
- base_shaCommitHash (string)
filesarray of DiffFileSummary
- The DiffFileSummary schema
- additionsinteger0–∞
- deletionsinteger0–∞
- generatedbooleanLooks generated — a lock file, a minified bundle, a snapshot — judged from the path. A page read with patches also honours the repository's
.gitattributes. - is_binarybooleanA binary file: it has no line counts and no patch.
- pathstring
- statusDiffFileStatusaddedmodifieddeletedrenamedcopied
- old_pathstring or nulloptionalThe file's previous path, for a rename or copy. Pass it as
old_pathwhen reading the file's own diff, or a renamed file reads as the whole file added.
- head_shaCommitHash (string)
statsDiffStats
- The DiffStats schema
- additionsinteger0–∞Lines added across the whole change.
- deletionsinteger0–∞Lines deleted across the whole change.
- files_changedinteger0–∞Every file the change touches.
- truncatedbooleanThe change touches more files than are listed.
statsstill counts all of them.
200 exampleSynthesized example
{
"base_sha": "4ee57b5e61fc4d698bafe67aeead2e73e97a756f",
"files": [
{
"additions": 52,
"deletions": 55,
"generated": false,
"is_binary": false,
"path": "path-eb95",
"status": "added"
}
],
"head_sha": "7874df1487d32c166a0b82bcce64b56b83c1ecc8",
"stats": {
"additions": 81,
"deletions": 14,
"files_changed": 11
},
"truncated": false
}
400Missing or invalid base/headapplication/json
Error codes
- BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-0516",
"message": "Label every synthesized example"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
- UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-4fa6",
"message": "Label every synthesized example"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
- FORBIDDENYou are signed in but may not do this here;
reasonnames the permission or the rule that refused it - INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs;
required_scopenames it - PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-1654",
"message": "Inline scalar newtypes but keep their brand"
}
}
404Repository not found, or a commit that is not in itapplication/json
Error codes
- NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
errorErrorBody
- The ErrorBody schema
- codestringThe coarse category, tied to the status:
NOT_FOUND,CONFLICT,INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all. - messagestringWhat went wrong, for a person. Written to be read, not parsed: match on
reasonorcode. - fieldstring or nulloptionalOn a
400that refused one field's value, the field, as its JSON path:email,items[0].name. Put the message under that input. Absent on every other error. - reasonstring or nulloptionalThe specific code, when the error has one:
LAST_ORGANIZATION_OWNER,BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and oncodeotherwise. - required_scopestring or nulloptionalThe scope the access token was missing, on
INSUFFICIENT_SCOPE. - violationsanyoptionalPresent on the structured-validation errors (
PROVIDER_VALIDATION_FAILEDper-node,PIPELINE_VALIDATION_FAILEDDAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-b4c0",
"message": "Pin a page's payload to the build that rendered it"
}
}
CLI
gitmoap diffs get-diff-files
- --repo-ididRepository ID (id or owner/repo path)
- --basestringBase commit SHA — a diff's base_sha. Required.
- --headstringHead commit SHA — a diff's head_sha. Required.