API / list-origin-pull-request-commits-via-api

API

List Origin Pull Request Commits via the API

List the commits on a pull request with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls/{pullNumber}/commits. Official reference: Origin API → List Pull Request Commits (OpenAPI OriginService_ListPullRequestCommits).

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 commit uses the shared Commit shape: top-level sha and parents, with author/committer/message/tree nested under commit.

Cost: 1 point against the principal budget (ordinary read).

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 commits 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 commit offset — 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/commits?pageSize=30' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

200 returns commits (an array of Commit) and nextPageToken (empty when there is no next page).

{
  "commits": [
    {
      "sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
      "commit": {
        "author": {
          "name": "Jane Doe",
          "email": "jane@acme.dev",
          "date": "2026-08-01T09:30:00Z"
        },
        "committer": {
          "name": "Jane Doe",
          "email": "jane@acme.dev",
          "date": "2026-08-01T09:30:00Z"
        },
        "message": "Add launch telemetry",
        "tree": {
          "sha": "a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b8"
        }
      },
      "parents": [
        {
          "sha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8"
        }
      ],
      "stats": {
        "additions": 128,
        "deletions": 46,
        "total": 174
      }
    }
  ],
  "nextPageToken": ""
}

Pass a non-empty nextPageToken as pageToken on the next request. File-level diffs for a single commit use List Commit Files; the changed-file list for the whole pull uses List Pull Request Files.

Base URL: https://api.cursor.com/v1/origin.