API / update-origin-pull-request-via-api

API

Update an Origin Pull Request via the API

Change a pull request's title, body, base branch, and/or lifecycle state with PATCH https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls/{pullNumber}. Official reference: Origin API → Update Pull Request (OpenAPI OriginService_UpdatePullRequest). Changelog notes: September 12, 2026 (base must name an existing branch), August 25, 2026 (title and body length caps).

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

Omitted fields stay unchanged. Present fields apply in order: metadata, then reopen/draft/ready-for-review, then base, then close. Close runs last so a same-request retarget can still see an open change; reopen runs before base so a closed pull can be retargeted. If a later step fails, earlier steps may already have been committed. Merged is not writable here — call Merge Pull Request instead. Pull request number is a JSON string (protobuf 64-bit encoding).

Cost: 5 points against the principal budget (ordinary write).

Path parameters

Param Required Meaning
ownerSlug yes Owning entity's unique slug
repoName yes Repo name, unique to the owner
pullNumber yes Pull request number within the repository (string on the wire)

Request body

Field Required Meaning
title no New title; max 256 Unicode code points
body no New description; empty string clears the body; max 65,536 Unicode code points
state no "open" or "closed". "closed" closes the pull. "open" without draft: true marks it ready for review (including publishing an existing draft)
draft no true marks draft; false marks ready for review (and reopens if currently closed). Ignored when state is "closed"
base no New base branch; must name an existing branch (not a commit SHA or tag). May update stack parentage when the new base is another change's head (or the default branch)

A base that is a commit SHA, a tag, or a missing branch returns InvalidArgument (HTTP 400).

curl --request PATCH \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls/17' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Add launch telemetry",
  "body": "Adds structured launch telemetry to the ignition path.",
  "state": "open",
  "draft": false,
  "base": "main"
}'

Response

200 returns the updated PullRequest.

{
  "id": "pr_01k2ja2000e0080000000000d4",
  "number": "17",
  "state": "open",
  "draft": false,
  "merged": false,
  "title": "Add launch telemetry",
  "body": "Adds structured launch telemetry to the ignition path.",
  "head": {
    "ref": "add-telemetry",
    "sha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4"
  },
  "base": {
    "ref": "main",
    "sha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8"
  },
  "author": {
    "user": {
      "id": "user_01k2ja2000e0080000000000c3",
      "email": "jane@acme.dev"
    }
  },
  "createdAt": "2026-08-01T09:30:00Z",
  "updatedAt": "2026-08-02T14:45:00Z",
  "additions": 128,
  "deletions": 46,
  "changedFiles": 5,
  "labels": [
    {
      "id": "lbl_01k2ja2000e0080000000000m1",
      "name": "bug",
      "color": "d73a4a",
      "description": "Something isn't working"
    }
  ],
  "version": {
    "number": "3",
    "headSha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
    "baseSha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8",
    "createdAt": "2026-08-01T09:30:00Z"
  }
}

Parse number as a string. To land the change on its base, use Merge Pull Request (repository:contents:write). Base URL: https://api.cursor.com/v1/origin.