Skip to content

Replace all repository labels

PUT /api/v5/repos/{owner}/{repo}/project_labels

This endpoint replaces all labels of the specified repository. Pass a list of new label names to overwrite all existing labels in one go; label names are converted to lowercase and deduplicated. Passing an empty array clears all labels of the repository.

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 organization or an individual)
repo path string Yes Repository path
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "array",
  "description": "The list of label names after replacement. Passing an empty array clears all labels of the repository.",
  "items": {
    "type": "string",
    "description": "Label name"
  }
}

The request body is an array of label name strings. The backend converts label names to lowercase and deduplicates them.

Response parameters

This endpoint has no response body; it returns an empty object {} on success.

Error responses

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

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid parameters or the request cannot be parsed"
}

401 Unauthenticated

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

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

HTTP status codes

Status code Description
200 Success (OK)
304 Not modified
401 Requires authentication
403 Forbidden

Request example

Parameter notes

Replace <owner> with the namespace address the repository belongs to (the address path of an organization or an individual); replace <repo> with the repository path; replace <token> with your AtomGit user access token.

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/project_labels?access_token=<token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '["label1", "label2"]'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/project_labels?access_token=<token>", {
  method: "PUT",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify(["label1", "label2"]),
});

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

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

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/project_labels",
    params={"access_token": "<token>"},
    headers={
        "Accept": "application/json",
        "Content-Type": "application/json",
    },
    json=["label1", "label2"],
    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/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