API / list-origin-pull-requests-via-api

API

List Origin Pull Requests via the API

List pull requests with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls. Official reference: Origin API → List Pull Requests (OpenAPI OriginService_ListPullRequests).

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.

Filter by head branch, base branch, author, creation-time range, and state. Sort with sortBy (created default, or updated) and direction (desc default, or asc). Each pull request includes its assigned labels. Pull request number is a JSON string (protobuf 64-bit encoding).

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

Query parameters

Param Required Meaning
head no Exact head-branch filter; omit for every branch
base no Exact base branch (main or refs/heads/main); omit for every base
author no Actor id (user_… / app_… / sa_…) or exact email (case-insensitive)
state no open (default), closed, merged, or all (closed includes merged)
since no Inclusive lower bound on creation time (RFC 3339)
until no Inclusive upper bound on creation time (RFC 3339)
sortBy no created (default) or updated
direction no desc (default) or asc
pageSize no Max results (default 30, max 100)
pageToken no Opaque cursor from a previous nextPageToken
curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls?state=open&pageSize=30' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Open PRs into main, newest first:

curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls?base=main&state=open&sortBy=created&direction=desc' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

The body carries pullRequests and an optional nextPageToken. Each entry includes id, number (string), state, draft, merged, title, body, head / base refs, author, timestamps, line stats, labels, and latest version.

Example shape from the OpenAPI:

{
  "pullRequests": [
    {
      "id": "pr_01k2ja2000e0080000000000d4",
      "number": "17",
      "state": "open",
      "draft": false,
      "merged": false,
      "title": "Add launch telemetry",
      "body": "Adds structured launch telemetry to the ignition path.",
      "head": {
        "ref": "add-telemetry",
        "sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4"
      },
      "base": {
        "ref": "main",
        "sha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8"
      },
      "author": {
        "user": {
          "id": "user_01k2ja2000e0080000000000c3",
          "email": "jane@acme.dev"
        }
      },
      "createdAt": "2026-08-01T09:30:00Z",
      "updatedAt": "2026-08-02T14:45:00Z",
      "additions": 128,
      "deletions": 46,
      "changedFiles": 5,
      "labels": [
        {
          "id": "lbl_01k2ja2000e0080000000000m1",
          "name": "bug",
          "color": "d73a4a",
          "description": "Something isn't working"
        }
      ],
      "version": {
        "number": "3",
        "headSha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
        "baseSha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8",
        "createdAt": "2026-08-01T09:30:00Z"
      }
    }
  ]
}

Parse number as a string. An author that does not resolve uniquely yields an empty list. Invalid state, sortBy, direction, or malformed timestamps return INVALID_ARGUMENT. Treat page tokens as opaque; restart when filters change.

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