Skip to content

Delete pull request labels

DELETE /api/v5/repos/{owner}/{repo}/pulls/{number}/labels/{name}

This endpoint deletes one or more labels from a specific pull request in the specified repository. You can delete labels in bulk by separating label names with English commas, and a successful deletion returns an empty object, which makes it easy to clean up and maintain pull request labels.

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace address of the repository (the address path of an enterprise, organization, or user)
repo path string Yes Repository path (path)
number path integer Yes Ordinal number of the pull request in this repository
name path string Yes Label name (separate multiple labels with English commas for bulk deletion, for example: bug,feature)
access_token query string Yes User authorization code

Response parameters

After the pull request labels are deleted successfully, the endpoint returns an empty object {} with no specific fields.

Error response

A 200/success response alone is not enough: callers need to know what failures look like in order to write error handling.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Parameter name cannot be empty",
  "field": "name"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

404 Not found

{
  "error": "not_found",
  "message": "Pull request or label not found"
}

Note: The error field names above are as actually returned by the backend.

HTTP response status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 Not found
429 Too many requests
500 Internal server error

Request example

Parameter description

<owner> — Namespace address of the repository (the address path of an enterprise, organization, or user); <repo> — Repository path (path); <number> — Ordinal number of the pull request in this repository; <name> — Label name (separate multiple labels with English commas for bulk deletion, for example bug,feature); <token> — Replace with your AtomGit user access token.

cURL

curl -X DELETE 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels/<name>?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels/<name>?access_token=<YOUR-TOKEN>",
  {
    method: "DELETE",
    headers: {
      "Accept": "application/json",
    },
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.delete(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/pulls/<number>/labels/<name>",
    params={"access_token": "<YOUR-TOKEN>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
400 Invalid parameters or the request cannot be parsed
404 The request path does not exist
405 Request method not supported
429 Too many requests; the rate limit is triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc