
Set Origin Pull Request Labels via the API
Replace every label on a pull request with PUT https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}/pulls/{pullNumber}/labels. Official reference: Origin API → Set Pull Request Labels (OpenAPI OriginService_SetPullRequestLabels).
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.
The body names the labels to assign after the call. An empty labels array removes every assigned label. Named labels must already exist in the repository; an unknown name or an unknown pull returns 404. Duplicate names are ignored. Naming more than 100 labels returns FailedPrecondition (HTTP 400). A pull request can hold at most 100 labels. Pull request number is a JSON string. A 404 never distinguishes a missing pull from one your installation cannot reach.
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 |
|---|---|---|
labels |
yes | Label names to assign after replacement. Maximum 100. Empty list clears all assigned labels. Duplicates ignored |
curl --request PUT \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls/17/labels' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"labels": [
"bug",
"needs-review"
]
}'
Clear every label:
curl --request PUT \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME/pulls/17/labels' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"labels": []
}'
Response
200 returns labels assigned after the replacement, ordered by name. Each entry carries id, name, color, and description.
{
"labels": [
{
"id": "lbl_01k2ja2000e0080000000000m1",
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
}
]
}
To add without clearing existing labels, use Add Pull Request Labels. Base URL: https://api.cursor.com/v1/origin.