Skip to content

What a pull request changes: the files it touches and their line-by-line diff against the commit it started from.

GET/repos/{owner}/{name}/pulls/{number}/changes

Use it to review a pull request or to compare several made for the same issue.

A file’s status is added, modified or deleted. A binary file has no hunks. In a line, old is null when it was added and new is null when it was deleted.

  • Authentication: Optional. Public data can be read without a token; send one to see what is private.
  • MCP tool: pull_request with action changes, and the same inputs
  • Scope: An access token needs pull_requests:read.
Name Type Required Description
owner string Yes The workspace that owns the repository.
name string Yes The repository’s name.
number integer Yes The number shown after the #. Issues and pull requests share one sequence.
curl https://api.g1t.sh/repos/flagon-io/hello/pulls/14/changes \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

{
"base": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
"head": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
"files": [
{
"path": "src/main.rs",
"status": "modified",
"additions": 1,
"deletions": 1,
"binary": false,
"hunks": [
{
"lines": [
{
"kind": "context",
"old": 3,
"new": 3,
"text": "fn main() {"
},
{
"kind": "delete",
"old": 4,
"new": null,
"text": " println!(\"Hello, world!\");"
},
{
"kind": "add",
"old": null,
"new": 4,
"text": " println!(\"Hello, {}!\", std::env::args().nth(1).unwrap_or(\"world\".into()));"
},
{
"kind": "context",
"old": 5,
"new": 5,
"text": "}"
}
]
}
]
}
],
"truncated": false
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
422 invalid The input is not valid. message says which field and why.