
Filter Origin Pull Requests by Head SHA via the API
Select pull requests whose head has (or once had) a given commit with the headSha query on List Pull Requests: GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls?headSha=FULL_SHA. Official reference: Origin API → List Pull Requests. Changelog: September 22, 2026.
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.
headSha must be the full 40- or 64-character hex SHA of a pull request head. It matches when any recorded version of the pull request has that head commit — current or superseded — so compare head.sha on each result to tell a live head from a superseded one. Malformed, abbreviated, and unknown SHAs match nothing (empty list), not an error.
Cost: 1 point against the principal budget (ordinary read).
Example
curl --request GET \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls?headSha=9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4&state=all' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'
Combine with other list filters (state, base, author, sortBy, direction, stackId, time bounds) the same way as List Origin Pull Requests via the API. Page tokens embed the filters they were minted under — restart pagination when headSha changes.
Related
- Stack listing: Stack Origin Pull Requests via the API.
- Full list surface: List Origin Pull Requests via the API.
Pitfalls
- Short SHAs never match. Send the full hex digest.
- A match on a superseded version still returns the pull request — check
head.shabefore treating it as the current tip.