
Create Origin Git Ref via the API
Create a branch at an existing commit with POST https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/git/refs. Official reference: Origin API and changelog (OpenAPI OriginService_CreateGitRef; added 2026-09-05).
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:write. Availability: Early Beta per the API overview.
Only branch references can be created: send ref as refs/heads/<branch> or heads/<branch>. Tags and other namespaces return InvalidArgument (HTTP 400). sha must be the full hex SHA of a commit already in the repository. Creating a branch that already points at sha returns the existing reference; a branch that exists at another commit returns AlreadyExists (HTTP 409 Conflict). A create blocked by a push ruleset, or on a repository whose contents are mirrored from another host, returns FailedPrecondition (HTTP 400).
Cost: 5 points against the principal budget (ordinary write; changelog).
Path parameters
| Param | Required | Meaning |
|---|---|---|
ownerSlug |
yes | Owning entity's unique slug |
repoName |
yes | Repo name, unique to the owner |
Request body
| Field | Required | Meaning |
|---|---|---|
ref |
yes | Branch as refs/heads/<branch> or heads/<branch> |
sha |
yes | Full hex SHA of an existing commit |
curl --request POST \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/git/refs' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"ref": "refs/heads/feature/login",
"sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4"
}'
Response
200 returns a GitRef: ref is the full branch name, and object has sha and type (commit for a branch).
{
"ref": "refs/heads/feature/login",
"object": {
"sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
"type": "commit"
}
}
After the branch exists, advance it with Create Commit From Files or Git HTTPS push. Base URL: https://api.cursor.com/v1/origin.