Skip to content

Get all task labels in a repository

GET /api/v5/repos/{owner}/{repo}/labels

This endpoint gets all task labels in the specified repository, returning the label ID, name, color, and owning repository ID, among other information. It also supports controlling the number of returned labels via pagination parameters.

Access token support

  • AtomGit user access tokens

Anonymous access allowed

Anonymous access is 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
page query string No The current page number
per_page query string No The number of items per page, maximum 100, default 100

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
repository_id integer Yes No Repository ID

Note: The response body is an array of label objects, where each element is a single label object.

Error responses

This endpoint may return the following error responses:

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "The parameter owner cannot be empty",
  "field": "owner"
}

404 Resource not found

{
  "error": "not_found",
  "message": "Repository 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
404 Not found
500 Internal server error

Request example

Parameter notes

<owner> is the namespace address the repository belongs to (the address path of an enterprise, organization, or individual); <repo> is the repository path. This endpoint allows anonymous access; you can also carry an AtomGit user access token via the access_token query parameter for authentication.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/labels' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/labels", {
  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.get(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/labels",
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 12738107,
    "name": "wontfix",
    "color": "#CCCCCC",
    "repository_id": 4066481
  },
  {
    "id": 12738106,
    "name": "question",
    "color": "#D876E3",
    "repository_id": 4066481
  }
]

Error codes

Error code Description
400 Invalid parameters or the request cannot be parsed
404 Request path or resource does not exist
500 Internal system error

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