Skip to content

List all members of the enterprise

GET /api/v5/enterprises/{enterprise}/members

This endpoint lists all members of the specified enterprise. It supports filtering members by role and returns the enterprise member list page by page, including each member's role and user information.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
enterprise path string Yes Enterprise path (path/login)
access_token query string Yes User authorization code
page query integer No Current page number; defaults to 1
per_page query integer No Number of items per page; maximum 100, default 30
role query string No Filter members by role. Enum: all / admin / member; default all

Response parameters

The response body is an array of member objects. Each array element represents one enterprise member.

Member object

Field Type Always returned Nullable Description
user object Yes No User information of the member
url string Yes No Member details API URL
active boolean Yes No Whether the member is activated
role string Yes No Member role, such as admin / member
role_name string Yes No Role name
role_id string Yes No Role ID
role_name_cn string Yes No Role name in Chinese

user object

Field Type Always returned Nullable Description
user.avatar_url string Yes No User avatar URL
user.html_url string Yes No User profile URL
user.id string Yes No User ID
user.login string Yes No User login name
user.name string Yes No User name
user.url string Yes No User API URL
user.object_id string Yes No User object ID
user.user_id string Yes No Internal user ID on the platform

Error responses

400 Parameter error

{
  "error_code": 400,
  "error_code_name": "PARAMETER_ERROR",
  "error_message": "page must be greater than 0",
  "trace_id": "0c9f3f4a6b..."
}

401 Unauthenticated

{
  "error_code": 401,
  "error_code_name": "UNAUTHORIZED",
  "error_message": "Unauthorized",
  "trace_id": "0c9f3f4a6b..."
}

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Requires authentication
403 Forbidden
404 Resource not found (Not found)
429 Too many requests; the rate limit was triggered
500 Internal system error (Internal server error)

Request example

Parameter description

<enterprise> — replace with the enterprise path (path/login), for example go-tribe; <token> — replace with your AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/enterprises/<enterprise>/members?access_token=<token>&page=1&per_page=20&role=all' \
  -H 'Accept: application/json'

JavaScript

const enterprise = "<enterprise>";
const token = "<token>";

const response = await fetch(
  `https://api.atomgit.com/api/v5/enterprises/${enterprise}/members?access_token=${token}&page=1&per_page=20&role=all`,
  {
    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/enterprises/<enterprise>/members",
    params={
        "access_token": "<token>",
        "page": 1,
        "per_page": 20,
        "role": "all",
    },
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "user": {
      "avatar_url": "https://api.atomgit.com/avatar/dengmengmian.png",
      "html_url": "https://api.atomgit.com/dengmengmian",
      "id": "268",
      "login": "dengmengmian",
      "name": "Ma Fan",
      "url": "https://api.atomgit.com/api/v5/dengmengmian",
      "object_id": "d8f1a0b2c3e4f5a6b7c8d9e0",
      "user_id": "100268"
    },
    "url": "https://api.atomgit.com/api/v5/enterprises/go-tribe/members/dengmengmian",
    "active": true,
    "role": "admin",
    "role_name": "admin",
    "role_id": "45a9-276d8e546f1b05f9f98ce1ffdc6",
    "role_name_cn": "Administrator"
  }
]

Error codes

Error code Description
400 Parameter error or the request cannot be parsed
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
403 Forbidden
404 The request path does not exist
429 Too many requests; the rate limit was triggered
500 Internal system error

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