Skip to content

List Followers of a Specified User

GET /api/v5/users/*/followers

List the followers of a specified user in a paginated manner, returning an array containing basic user information.

Access Token Support

  • AtomGit user access tokens

Anonymous Access Allowed

This endpoint allows anonymous access

Request Parameters

Parameter Name Location Type Required Description
username path string Yes Username (username/login)
page query integer No Current page number, must be greater than 0, defaults to 1
per_page query integer No Number of items per page, must be greater than 0, maximum is 100, default is 30

Response Parameters

Returns an array of follower user objects; the fields of each element in the array are as follows.

Field Type Always Returned Nullable Description
[] array Yes No List of follower users
[].avatar_url string Yes Yes Avatar URL
[].events_url string Yes Yes Events list API URL
[].followers_url string Yes Yes Followers list API URL
[].following_url string Yes Yes Following list API URL
[].gists_url string Yes Yes Gists API URL
[].html_url string Yes Yes Page URL of the user or organization
[].id string Yes Yes Identifier of the user or organization
[].object_id string Yes Yes User object identifier
[].login string Yes Yes Username or organization path
[].member_role string Yes Yes Member role
[].name string Yes Yes User nickname or organization name
[].organizations_url string Yes Yes Organizations list API URL
[].received_events_url string Yes Yes Received events list API URL
[].remark string Yes Yes Enterprise remark name
[].repos_url string Yes Yes Repository list API URL
[].starred_url string Yes Yes Starred repositories list API URL
[].subscriptions_url string Yes Yes Subscriptions list API URL
[].type string Yes Yes Object type: User indicates a user, Organization indicates an organization
[].url string Yes Yes Details API URL of the user or organization

Failure Responses

When the call fails authentication or parameter validation, the server returns the corresponding error status code.

400 Parameter Error

{
  "error": "invalid_request",
  "message": "page must be greater than 0",
  "field": "page"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

HTTP Response Status Codes

Status Code Description
200 Success (OK)
400 Request parameter error (Bad Request)
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Request path does not exist (Not Found)
429 Too many requests, rate limit triggered (Too Many Requests)
500 Internal system error (Internal Server Error)

Request Example

Parameter Description

Replace <username> with the username (username/login); This endpoint allows anonymous access, and you may also pass an AtomGit user access token via access_token=<token>.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/users/<username>/followers?page=1&per_page=30' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch(
  "https://api.atomgit.com/api/v5/users/<username>/followers?page=1&per_page=30",
  {
    headers: {
      "Accept": "application/json",
    },
  },
);

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

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

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/users/<username>/followers",
    params={"page": 1, "per_page": 30},
    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",
    "html_url": "https://atomgit.com/xiaogang",
    "type": "User",
    "followers_url": "https://api.atomgit.com/api/v5/users/xiaogang/followers",
    "following_url": "https://api.atomgit.com/api/v5/users/xiaogang/following",
    "repos_url": "https://api.atomgit.com/api/v5/users/xiaogang/repos",
    "url": "https://api.atomgit.com/api/v5/users/xiaogang"
  }
]

Error Codes

Error Code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Parameter error or unparsable request
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