Skip to content

Update a repository's task label

PATCH /api/v5/repos/{owner}/{repo}/labels/{original_name}

This endpoint updates a task label of the specified repository, locating the target label by its original name. It supports changing the label's new name and color; on success it returns the label's ID, name, and color information.

Access token support

  • AtomGit user access tokens

Anonymous access allowed

Anonymous access is not allowed for this endpoint.

Request parameters

Parameter Location Type Required Description
owner path string Yes The namespace address the repository belongs to (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path
original_name path string Yes The label's original name
access_token query string Yes User authorization code
name query string No The label's new name
color query string No The label's new color

Response parameters

Field Type Always returned Nullable Description
id integer Yes No Label ID
name string Yes No Label name
color string Yes No Label color

Error responses

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid request parameters",
  "field": "name"
}

401 Unauthenticated

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

404 Resource not found

{
  "error": "not_found",
  "message": "Repository or label does not exist"
}

The actual error field names are determined by what the backend returns.

HTTP status codes

Status code Description
200 Success (OK)
400 Bad Request
401 Requires authentication
403 Forbidden
404 Not Found

Request example

Parameter notes

Replace <owner> with the namespace address the repository belongs to (the address path of an enterprise, organization, or individual); replace <repo> with the repository path; replace <original_name> with the label's original name; replace <token> with your AtomGit user access token; replace <name> with the label's new name (optional); replace <color> with the label's new color (optional).

cURL

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

JavaScript

// Native fetch (Node.js 18+ / browsers)
const params = new URLSearchParams({
  access_token: "<token>",
  name: "<name>",
  color: "<color>",
});

const response = await fetch(
  `https://api.atomgit.com/api/v5/repos/<owner>/<repo>/labels/<original_name>?${params}`,
  {
    method: "PATCH",
    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

params = {
    "access_token": "<token>",
    "name": "<name>",
    "color": "<color>",
}

resp = requests.patch(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/labels/<original_name>",
    params=params,
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": 12738100,
  "name": "list",
  "color": "#ED4014"
}

Error codes

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

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