API / get-origin-ruleset-via-api

API

Get Origin Ruleset via the API

Return one repository ruleset by its stable Origin id with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/rulesets/{rulesetId}. Official reference: Origin API and changelog (OpenAPI OriginService_GetRuleset; added 2026-08-21).

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

rulesetId is the stable id from Create or List (typically rs_…). A ruleset stored on another repository, or one the caller cannot see, returns 404; not-found and no-access are deliberately indistinguishable.

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
rulesetId yes Stable Origin ruleset id
curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/rulesets/rs_01k2ja2000e0080000000000t7' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

200 returns a Ruleset with id, name, description, enforcement, kind, includedRefNames, excludedRefNames, rules, and bypassActors.

{
  "id": "rs_01k2ja2000e0080000000000t7",
  "name": "require-review",
  "description": "Require an approving review before merging to main.",
  "enforcement": "active",
  "kind": "merge_branch",
  "includedRefNames": ["refs/heads/main"],
  "rules": [
    {
      "id": "rsr_01k2ja2000e0080000000000v8",
      "ruleType": "pull_request",
      "parameters": {
        "requiredApprovingReviewCount": 1
      }
    }
  ],
  "bypassActors": [
    {
      "id": "rsba_01k2ja2000e0080000000000w9",
      "bypassMode": "always",
      "user": {
        "id": "act_01k2ja2000e0080000000000x0"
      }
    }
  ]
}

To replace configuration, use Update Ruleset. Base URL: https://api.cursor.com/v1/origin.