API / list-origin-pull-request-labels-via-api

API

List Origin Pull Request Labels via the API

List every label assigned to a pull request with GET https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls/{pullNumber}/labels. Official reference: Origin API → List Pull Request Labels (OpenAPI OriginService_ListPullRequestLabels).

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:read. Availability: Early Beta per the API overview.

The response is the full assigned list ordered by name. There are no pagination parameters. A pull request can have at most 100 labels. Pull request number is a JSON string (protobuf 64-bit encoding). An unknown or unreachable pull returns 404. A 404 never distinguishes a missing pull from one your installation cannot reach.

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
pullNumber yes Pull request number within the repository (string on the wire)
curl --request GET \
  --url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls/17/labels' \
  --header 'Authorization: Bearer YOUR_ORIGIN_TOKEN'

Response

200 returns labels: each entry carries id (lbl_…), name, color (six-character hex without a leading #), and description (absent when the label has none).

{
  "labels": [
    {
      "id": "lbl_01k2ja2000e0080000000000m1",
      "name": "bug",
      "color": "d73a4a",
      "description": "Something isn't working"
    }
  ]
}

Assign or clear labels with Set, Add, Remove, or Remove All Pull Request Labels. Repository label definitions live under List Labels. Base URL: https://api.cursor.com/v1/origin.