API / list-origin-commits-via-api

API

List Origin Commits via the API

Page commits on a branch or starting ref with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/commits. Official reference: Origin API → Commits / List Commits (OpenAPI OriginService_ListCommits).

Origin is in Early Beta and subject to change. Authenticate with an installation access token (oit_…) or a user access token that carries repository:contents:read. Availability: Early Beta per the API overview.

Optional query sha accepts a SHA, branch, tag, or symbolic ref such as HEAD. Leave it empty to start from the repository's default branch. Default page size is 30; values above 100 clamp to 100. A supplied pageToken encodes the starting ref and page, so sha and pageSize on a follow-up request are ignored.

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
sha no SHA, branch, tag, or HEAD to start from; empty = default branch
pageSize no Max commits to return (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/commits?pageSize=30' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Start from a branch:

curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/commits?sha=main&pageSize=30' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

The body carries commits and an optional nextPageToken (empty when no next page). Each commit includes sha, nested commit (author, committer, message, tree), parents, and aggregate stats (additions, deletions, total).

Example shape from the OpenAPI:

{
  "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
      }
    }
  ]
}

Treat page tokens as opaque. Restart pagination when the starting sha changes. Fetch one commit by SHA or ref with Get Commit; page its changed files with List Commit Files.

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