API / get-origin-commit-via-api

API

Get an Origin Commit via the API

Fetch one commit by SHA or ref with whole-commit aggregate stats using GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/commits/{sha}. Official reference: Origin API → Commits / Get Commit (OpenAPI OriginService_GetCommit).

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.

The path sha accepts a SHA, branch, tag, or symbolic ref such as HEAD. The response is a single Commit with nested message metadata, parents, and aggregate stats. Per-file diffs live on List Commit Files. A 404 does not tell you whether the ref is missing or merely invisible to this credential.

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
sha yes SHA, branch, tag, or HEAD of the commit to fetch
curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/commits/9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Resolve HEAD on the default tip:

curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/commits/HEAD' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

The body is a Commit: sha, nested commit (author, committer, message, tree), parents, and stats (additions, deletions, total).

Example shape from the OpenAPI:

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

Use List Commits to page history, then call this endpoint when you need one resolved commit with aggregate stats before listing its files.

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