API / get-origin-blob-via-api

API

Get Origin Blob via the API

Read a Git blob object by SHA with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/git/blobs/{sha}. Official reference: Origin API (OpenAPI OriginService_GetBlob).

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 default response is JSON with MIME-wrapped base64 content. Pass Accept: application/vnd.origin.raw+json or application/vnd.origin.raw to receive raw blob bytes instead. Blobs larger than 4 MiB (decoded) are rejected; fetch larger files by cloning over Git HTTPS. An empty repository returns 409 Conflict.

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 Full or abbreviated hex SHA of the blob object
curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/git/blobs/9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Raw bytes:

curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/git/blobs/9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
  --header 'Accept: application/vnd.origin.raw' \
  --output blob.bin

Response

JSON 200 returns sha, size (decoded bytes as a JSON number, int32), encoding always base64, and content wrapped at 60 characters per line with a trailing newline.

{
  "sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
  "size": 128,
  "encoding": "base64",
  "content": "IyBSb2NrZXQK\n"
}

Resolve a blob SHA from Get Contents (sha on a file entry) or from a tree walk. Base URL: https://api.cursor.com/v1/origin.