Skip to content

List users who have starred the repository

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

The user calls this endpoint to list all users who have starred the specified repository.

Access token support

  • AtomGit user access tokens (AtomGit user access tokens)

Anonymous access allowed?

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path (path)
page query integer No Current page number
per_page query integer No Number of items per page, maximum 100, default 20
starred_after query string No Starred after this time
starred_before query string No Starred before this time

Response parameters

The response body is a JSON array, and each element is an object representing a user who has starred the repository. The fields are as follows:

stargazer object (array element)

Field Type Always returned Nullable Description
id integer Yes No User ID
login string Yes No User login name
name string Yes No User name
avatar_url string Yes No User avatar address
starred_at string Yes No Time when the repository was starred

Error response

The reference documentation defines only the success response and provides no example of a business failure response; the actual error field names on failure are subject to what the backend returns.

HTTP response status codes

Status code Description
200 Success (OK)
401 Authentication required (Requires authentication)
404 Resource not found (Not found)
500 Internal system error (Internal server error)

Request example

Parameter description

This endpoint allows anonymous access, so the example does not include an access token; to access private resources as a specific user, append the access_token query parameter (user authorization code) to the request.

Replace <owner> with the address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual); replace <repo> with the repository path (path).

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/stargazers?page=1&per_page=20' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/stargazers?page=1&per_page=20", {
  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>/stargazers",
    params={"page": 1, "per_page": 20},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 496,
    "login": "xiaogang",
    "name": "xiaogang",
    "avatar_url": "https://api.atomgit.com/avatar.png",
    "starred_at": "2024-11-13T16:15:53.287+08:00"
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
404 Request path does not exist
500 Internal system error

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