
List Origin Pull Request Files via the API
List the files changed in a pull request with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls/{pullNumber}/files. Official reference: Origin API → List Pull Request Files (OpenAPI OriginService_ListPullRequestFiles).
Origin is in Early Beta and subject to change. Authenticate with an installation access token (oit_…) or a user access token that carries repository:pull_requests:read. Availability: Early Beta per the API overview.
Pull request number is a JSON string (protobuf 64-bit encoding). Each entry is a PullRequestFile with path, change status, line counts, and an optional unified patch.
Cost: 5 points against the principal budget (heavier read, same tier as List Comparison Files and List Commit Files).
Path parameters
| Param | Required | Meaning |
|---|---|---|
ownerSlug |
yes | Owning entity's unique slug |
repoName |
yes | Repo name, unique to the owner |
pullNumber |
yes | Pull request number within the repository (string on the wire) |
Query parameters
| Param | Required | Meaning |
|---|---|---|
pageSize |
no | Max changed files to return. Defaults to 30 when unset or 0. Values above 100 are clamped to 100 |
pageToken |
no | Opaque cursor from a previous response's nextPageToken. Empty for the first page. Bound to the repository, pull request version, page size, and changed-file cursor — restart pagination when those change |
A missing or unreachable pull returns 404. A 404 never distinguishes a missing pull from one your installation cannot reach. An invalid or mismatched non-empty pageToken returns 400.
curl --request GET \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls/17/files?pageSize=30' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'
Response
200 returns files (an array of PullRequestFile) and nextPageToken (empty when there is no next page).
| Field | Meaning |
|---|---|
filename |
Path of the changed file |
status |
"added", "removed", "modified", "renamed", or "copied" |
additions |
Lines added |
deletions |
Lines deleted |
changes |
Total line changes |
patch |
Unified diff hunk text when present |
previousFilename |
Prior path when renamed or copied |
{
"files": [
{
"filename": "src/telemetry.ts",
"status": "modified",
"additions": 6,
"deletions": 3,
"changes": 9,
"patch": "@@ -12,6 +12,9 @@\n import { ignite } from \"./ignition\";\n+import { emitLaunchTelemetry } from \"./telemetry\";\n"
}
],
"nextPageToken": ""
}
Pass a non-empty nextPageToken as pageToken on the next request. Aggregate line stats on the pull itself come from Get Pull Request (additions, deletions, changedFiles).
Base URL: https://api.cursor.com/v1/origin.